Issue In Removing Double Or More Slashes From URL By .htaccess

后端 未结 4 1838
遥遥无期
遥遥无期 2020-12-09 11:27

I am using the following htaccess rul to remove double or more slashes from web urls:

#remove double/more slashes in url
RewriteCond %{REQUEST_URI} ^(.*)//(.         


        
4条回答
  •  猫巷女王i
    2020-12-09 12:16

    Give it a try with:

    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/{2,} [NC]
    RewriteRule ^(.*) $1 [R=301,L]
    

    It should redirect to a single slash at the end of the domain. And an improvement on yours:

    RewriteCond %{REQUEST_URI} ^(.*)/{2,}(.*)$
    RewriteRule . %1/%2 [R=301,L]
    

提交回复
热议问题