Ron Ron - 1 year ago 57
Linux Question

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
file. but It doesnt work. when I go to or 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?


Ron Ron
Answer Source

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]