My website structure has a root /index.php, some files as /directory/index.php and some as /directory/(filename).php
I have the following .htaccess which removes the php extensions and the "index.php" for my URLs, and forces trailing slashes on the first level directories for SEO goodness:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.php
RewriteRule (.*)\.php$ /$1/ [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)/$ $1.php [L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule .*[^/]$ $0/ [L,R=301]
so the following are working (they show the correct page):
/
/directory/
/directory/filename/
The only thing that doesn't work, is if I type in:
/directory/filename
It goes to:
http://(mylocalurl)/Users/(myusername)/Sites/(mysitedirectory)/directory/filename/
My question is: How do I make the second level filename rewrite to force a trailing slash like:
/directory/filename/
Thanks for your help!