I need an .htaccess file which will do something like this:
- When user input
www.site.com/some_folder/test
it will keep the address as it is and open the corresponding page (test.php) - When user input
www.site.com/some_folder/test.php
it will remove .php extension towww.site.com/some_folder/test
and it will open the corresponding page (test.php)
What I have right now is:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
and it can only fulfill first scenario but not the second. (when I input www.site.com/some_folder/test.php
it will still show www.site.com/some_folder/test.php
)
What should I change / add in the .htaccess file to fulfill 2nd scenario ?
Any help will be very much appreciated.
Thanks very much.