I`m trying to hide my php files extension in my hosted server.i add following code segment in .htaccess file.
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.*)$ $1.html RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php
but when i try, it is not working. also i tried to do the same thing in my localhost.it is also not working properly.
so do i have to make any other changes to work on it?
Advertisement
Answer
Use
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^.]+)$ $1.php [NC,L]