Add slash at directories, remove slash at files - .htaccess
Ho开发者_开发问答w can I get this to work? I want one single trailing slash at directories, but no slashes at files. So test.php/
becomes test.php
and test/folder
becomes test/folder/
? Now I wrote this code, but that doesn't work:
# Remove trailing slash from files
RewriteCond %{REQUEST_URI} ^/([^/]*)([.]{1})([^./]{1,})/$
RewriteRule . %1.%3 [R=301,L]
# Add trailing slash at directories
RewriteCond %{REQUEST_URI} ^/([^/.]*)$
RewriteRule . %1/ [R=301,L]
精彩评论