Answer the question
In order to leave comments, you need to log in
How to configure .htaccess so that the rule is not executed for a specific directory on the server?
Hello.
There is a code that removes the .php extension from the URL:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^.*$ $0.php [L,QSA]
RewriteCond %{THE_REQUEST} ([^\s]*)\.php(\?[^\s]*)?
RewriteRule (.*) %1 [R=301,L]
Answer the question
In order to leave comments, you need to log in
RewriteCond %{REQUEST_URI} !^/folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^.*$ $0.php [L,QSA]
RewriteCond %{REQUEST_URI} !^/folder/
RewriteCond %{THE_REQUEST} (\S+)\.php
RewriteRule ^ %1 [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question