0

我有以下 htaccess: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^.*$ index.php [QSA,NC,L] 并且一切正常。但现在我需要从 url 中删除尾部斜杠。这意味着 http://localhost:8888/folder_app/en/psssses/index/asd/(注意尾部斜杠)将重定向到http://localhost:8888/folder_app/en/psssses/index/asd没有尾部斜杠...非常感谢您的帮助

4

1 回答 1

1

您可以为此使用新规则:

RewriteEngine On
RewriteBase /folder_app/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} /(.+?)/+[?\s]
RewriteRule ^(.+?)/$ $1 [R=301,L,NE]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
于 2014-09-02T20:42:52.807 回答