Remove php file extension, less than one folder

Asked

Viewed 553 times

0

I have the file. htaccess and want to take the file extensions less than the following: index.php and the system/functions/ folder which is the pas where my processing is

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)\.php
RewriteRule ^ /%1 [L,R=301]

1 answer

1


Place a new. htaccess file in the folder you want to ignore, with:

 RewriteEngine Off

And another at the root with

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/(.+)\.php[^\s]* [NC]
RewriteCond %{REQUEST_FILENAME} !index\.php
RewriteRule ^ /%1 [R=301,NE,L]
  • That’s right! It worked

Browser other questions tagged

You are not signed in. Login or sign up in order to post.