I want my urls to be extensionless, so no .php extension, I also want there not to be an opportunity to access the URL with a trailing slash.
The following removes php extension and thens redirects to the extensionless url if you try to access it with .php
I started writing a rule to stop you accessing with a / and redirect, but it does not work, any help?
#this removes php extension RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] # stops you accessing url with.php RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^.?\ ]+)\.php RewriteRule ^([^.]+)\.php(/.+)?$ /$1%{PATH_INFO} [R=301] # stops you accessing url with / **DOESNT WORK** RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)/$ /$1 [R=301,L]