I have the following code in my htaccess file:
# Force Trailing Slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^[^/]+$ %{REQUEST_URI}/ [L,R=301]
That seems to work fine when I go to www.mydomain.com/test it redirects it to /test/. The problem is when I go to www.mydomain.com/test/another it doesn't put the trailing slash on another.
Does anyone know how to modify my code to make the trailing slash work no matter how long the URL is?
Thanks!
Question&Answers:os