我的网站网址也接受双斜线。例如,当我放https://www.jamalacademy.com/class/9th-class
它接受然后我放
https://www.jamalacademy.com//class/9th-class
或https://www.jamalacademy.com///class/9th-class
它也接受..即使我添加了这么多斜杠也接受了..
帮助我解决这个问题。 我目前的htaccess文件就像:
RewriteEngine On
RewriteCond %{THE_REQUEST} \s/+(.*?)/{2,}([^\s]*)
RewriteRule ^ %1/%2 [R=302,L,NE]
RedirectMatch 301 ^(.*)//+(.*)$ https://www.jamalacademy.com/$1/$2
RewriteEngine On
RewriteBase /
Options +FollowSymlinks
RewriteCond %{REQUEST_URI} //+
RewriteRule ^(.*) $1 [R=301,L]
RewriteEngine On
RewriteRule ^class/(.*)/?$ classes_list.php?get_page=$1 [NC,QSA]
提前谢谢。
答案 0 :(得分:0)
你可以像这样使用它:
RewriteEngine On
# remove multiple slashes from URLs
RewriteCond %{THE_REQUEST} //
RewriteRule ^.*$ /$0 [R=301,L,NE]
RewriteRule ^class/(.*?)/?$ classes_list.php?get_page=$1 [NC,QSA,L]
确保在测试此更改之前清除浏览器缓存。