Reputation: 770
Trying to remove double slashes after domain. The following mod_rewrite expressions seem to work for URLs such as http://example.com//login, but do not work for domain//
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]
I want to convert URL from :
http://example.com//login
To
http://example.com/login
Would you please give me proper suggestion about how to remove double slashes from url?
Any kind of help would be highly appreciated.
Thanks in advance.
Upvotes: 0
Views: 473
Reputation: 41219
Try :
RewriteEngine on
RewriteRule ^/+(.*)$ /$1 [L,R]
You can also use RedirectMatch
RedirectMatch ^//+(.*)$ /$1
Upvotes: 1