开发者

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]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜