Ron
Ron

Reputation: 4095

mod_rewrite enabled but does not work properly

About an hour ago, I Added

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*[^/])/?$
RewriteCond %{DOCUMENT_ROOT}%1.php -f
RewriteRule .+ %1.php [QSA,L]

to my .htaccess file. but It doesnt work. when I go to mywebsite.com/info or mywebsite.com/info/ it doesnt work (the page is info.php). the mod_rewrite is enabled - tested it by RewriteRule that redirected me to google from any page in my site.

I have no idea what's the problem.. maybe the code is wrong?

Thanks.

Upvotes: 4

Views: 433

Answers (3)

Ron
Ron

Reputation: 4095

This's what I needed for the rules to work:

RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)/$ $1.php [L]

Upvotes: 1

Kyle Ramirez
Kyle Ramirez

Reputation: 11

GoDaddy takes about an hour to parse your newly uploaded .htaccess file. It's strange. But the file should work fine as is if you just wait.

Upvotes: 1

RoUS
RoUS

Reputation: 1990

@Ron

Try changing the last two lines to this:

RewriteCond %1.php -f
RewriteRule .+ %1.php [PT]

You'll need the [PT] in order for the PHP file to be processed correctly.

Upvotes: 2

Related Questions