0

My urls have http://test.com//123.html

Notice it has // from a 3rd party which is not under my control so I want to catch // urls and redirect it to single slash. I have this in my .htaccess

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

However it is not working and I see still // in the browser. Is there any issue in my code?

Jay Blanchard
  • 33,530
  • 16
  • 73
  • 113
Tim Liberty
  • 2,089
  • 3
  • 20
  • 38

1 Answers1

1

Try this

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

Check this

Samuel James
  • 1,480
  • 15
  • 15