Mod_rewrite is on but not working 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] 

into my .htaccess file. but it does not work. when I go to mywebsite.com/info or mywebsite.com/info/ it does not work (page - info.php). mod_rewrite enabled - checked by RewriteRule, which redirected me to google from any page on my site.

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

Thanks.

+4
source share
3 answers

This is what I need for the rules of work:

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

@Ron

Try changing the last two lines:

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

You will need [PT] for the PHP file to be processed correctly.

+2
source

GoDaddy takes about an hour to parse your newly downloaded .htaccess file. This is strange. But the file should work fine, as if you just waited.

+1
source

Source: https://habr.com/ru/post/1337395/


All Articles