I used this code
## remove the php extention
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
This works for some files the e.g. example.com/contact, but doesn't work when I have a .php file that is also a directory. For example, in the root folder:
science.php
science - folder
The articles are in categories e.g. http://example.com/science/themost-blabla.php - this works, the .php extionsion doesn't appear in the URL.
So I want to know if is any possible to hide the .php extension to science.php because when I type example.com/science ... it redirects me to the content of the science folder....
Index of /science directory:
afla-care-a-fost-primul-meci-televizat-de-fotbal-din-lume-1937-arsenal.phpcazinoul-din-constanta.php cele-7-minuni-ale-lumii.phpdescoperire-colosala-a-epavei-navei-spaniole-san-jose-ce-avea-la-bord-o-avere-impresionanta.phpimagini/ mitologia-greaca.php poenaru.phptop-10-cele-mai-importante-inventii-romanesti-din-istorie.phptop-5-enigme-ale-lumii.php turnul-eiffel.php
So, can I do something to hide the extension to this page? Or do I need to change the name of the file - to not be the some as the folder?