Redirect or Rewrite to Remove Multiple Slashes in URL

by Francis 2014-03-29 10:15:06

Redirect or Rewrite to Remove Multiple Slashes in URL


# Remove multiple slashes anywhere in URL
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]

RewriteCond %{HTTP_HOST} !=""
RewriteCond %{THE_REQUEST} ^[A-Z]+s//+(.*)sHTTP/[0-9.]+$ [OR]
RewriteCond %{THE_REQUEST} ^[A-Z]+s(.*/)/+sHTTP/[0-9.]+$
RewriteRule .* http://%{HTTP_HOST}/%1 [R=301,L]


In Redirection %25 added in url use following htaccess redirection

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

RewriteCond %{HTTP_HOST} !=""
RewriteCond %{THE_REQUEST} ^[A-Z]+s//+(.*)sHTTP/[0-9.]+$ [OR]
RewriteCond %{THE_REQUEST} ^[A-Z]+s(.*/)/+sHTTP/[0-9.]+$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

724
like
0
dislike
0
mail
flag

You must LOGIN to add comments