Skip to content

Instantly share code, notes, and snippets.

@rlandas
Created July 10, 2015 00:23
Show Gist options
  • Select an option

  • Save rlandas/9773a96c109ed5bc3532 to your computer and use it in GitHub Desktop.

Select an option

Save rlandas/9773a96c109ed5bc3532 to your computer and use it in GitHub Desktop.
APACHE Remove multiple slashes anywhere in the URL
# remove multiple slashes anywhere in url
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
@satyrdigital
Copy link

You're Genious, man!
The whole day of strugling and the final success.
All my attempts led to double 301 redirect like https://site.com//// >301> http://site.com/ >301> https://site.com/
Now it's just one hop https://site.com//// >301> https://site.com/

@drikpanchang
Copy link

This soution fails if URL has odd number of slashes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment