如何使用htaccess删除域后的双斜杠

时间:2017-04-13 11:24:32

标签: regex .htaccess

我有http://example.com//1771-1A之类的链接,如何使用.htaccess删除域地址后的双斜杠。

1 个答案:

答案 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