Jump to content


Photo

Rewrite Not Working

htaccess rewrite

Best Answer PravinS, 20 December 2013 - 12:38 AM

check if mod_rewrite is enabled in php.ini

Go to the full post


  • Please log in to reply
4 replies to this topic

#1 znaji

znaji

    Newbie

  • New Members
  • Pip
  • 8 posts

Posted 19 December 2013 - 06:36 PM

Hi

 

Rewrite rules will not work on cheap hosted godaddy server however rewrite works locally. Can someone le me know whats wrong or the right way please.

 

Working locally but not hosted.

 

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

#AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
#AddHandler x-httpd-php5-3  .php

RewriteRule ^profile/([a-zA-Z0-9_-]+)/comment/([0-9]+) statusview.php?s=$2&user=$1
RewriteRule ^profile/([a-zA-Z0-9_-]+)/notifications notifications.php?userid=$1
RewriteRule ^profile/([a-zA-Z0-9_-]+) profile.php?id=$1
RewriteRule ^create-account create-account.php
RewriteRule ^forgot-password forgot-password.php
RewriteRule ^about about.php
RewriteRule ^privacy privacy.php
RewriteRule ^terms-of-service terms-of-service.php
RewriteRule ^contact contact.php
RewriteRule ^login login.php
RewriteRule ^([a-z_-]+)/([a-z0-9_-]+)/([0-9]+) comment.php?subcat=$3
RewriteRule ^category/([a-zA-Z_-]+) category.php?cat=$1
RewriteRule ^how-it-works how-it-works.php
RewriteRule ^updates updates.php

 

Link http://www.example.com/profile/john does not work have to use

http://www.example.c...ile.php?id=john

to test.



#2 PravinS

PravinS

    Advanced Member

  • Members
  • PipPipPip
  • 430 posts
  • LocationNashik, India

Posted 20 December 2013 - 12:38 AM   Best Answer

check if mod_rewrite is enabled in php.ini


Thanks & Regards,
PravinS | Blog


#3 znaji

znaji

    Newbie

  • New Members
  • Pip
  • 8 posts

Posted 20 December 2013 - 01:42 AM

check if mod_rewrite is enabled in php.ini

Thank you I was over thinking it. However I found a simple soultion for Godaddy hosting (In my case).

Just add the follwoing and it fixed it right away.

#Fix Rewrite
Options -Multiviews



#4 Ch0cu3r

Ch0cu3r

    Advanced Member

  • Moderators
  • 2,307 posts

Posted 20 December 2013 - 04:44 AM

check if mod_rewrite is enabled in php.ini

mod_rewrite is not a PHP extension! It is an Apache module, which you can enable in the httpd.conf



#5 PravinS

PravinS

    Advanced Member

  • Members
  • PipPipPip
  • 430 posts
  • LocationNashik, India

Posted 20 December 2013 - 05:46 AM

mod_rewrite is not a PHP extension! It is an Apache module, which you can enable in the httpd.conf

 

yeah, thanks for correcting


Thanks & Regards,
PravinS | Blog





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com