Reputation: 194
Having problems finding a solution to this...
I have removed all file extensions from the url with the following .htaccess script.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
But when I try to access a directory it throws me to our standard 404 page.
For Example:
www.website.com/directory-name/page-name (works)
www.website.com/directory-name (does not go to index or directory-name.php) even though they both exist.
Thanks for your help
Upvotes: 1
Views: 23
Reputation: 41249
You need to exclude existent dirs from the RewriteRule :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
Upvotes: 1