Ad

How I Can Redirect From "www.mywebsite.com////" To "www.mywebsite.com"?

- 1 answer

Now I'm using:

RewriteRule (.*)/$ /$1 [R=301,L]

for redirect from "www.mywebsite.com/page/" or "www.mywebsite.com/page////" to "www.mywebsite.com/page".

Ad

Answer

You can use these 2 rules:

RewriteEngine On

# remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [R=302,NE,L]

# remove multiple slashes
RewriteCond %{THE_REQUEST} //
RewriteRule ^.*$ $0 [R=302,L,NE]
Ad
source: stackoverflow.com
Ad