mod_rewrite and double slash issue mod_rewrite and double slash issue apache apache

mod_rewrite and double slash issue


Fixed with:

RewriteEngine OnRewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]RewriteRule ^(.*)$ http://www.mydomain.com$1 [R=301,L]

because $1 by default contains the index path /


RewriteRule ^\/?(.*)$ http://www.mydomain.com/$1 [R=301,L]


Actually, you will always have double slashes due to

RewriteRule ^(.*)$ http://www.wxample.com/$1 [R=301,L]

combined with the fact that REQUEST_URI (that you are matching on) normally contains a starting slash. What you can try is RewriteRule ^(.*)$ http://example.com$1, and then send a broken HTTP request GET foo HTTP/1.0 and see if Apache deals with it properly.