Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*[^/])$ /$1/ [L,R=301]
当我使用它在末尾添加斜杠时,它会像 example.com// 一样重定向
但我想重定向我的网址
www.example.com
至
www.example.com/
任何人都可以建议我如何做到这一点?
你试过搜索论坛吗?
RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301]
资料来源:.htaccess 重写以在末尾强制使用斜杠
更多问题:
Htaccess:从 URL 添加/删除尾部斜杠
添加尾部斜杠 .htaccess
.htaccess 如果 url 不以扩展名结尾,则在末尾添加斜杠