标签: regex .htaccess
我有http://example.com//1771-1A之类的链接,如何使用.htaccess删除域地址后的双斜杠。
http://example.com//1771-1A
.htaccess
答案 0 :(得分:3)
从this answer开始,在Pro网站管理员堆栈上:
# Remove multiple slashes at the start of the URL-path RewriteCond %{THE_REQUEST} \ //+ RewriteRule (.*) /$1 [R=301,L]
参考: https://webmasters.stackexchange.com/questions/102221/redirect-url-with-multiple-trailing-dots-and-trailing-slashes-using-htaccess