htaccess remove double slash from URL

In: .htaccess

June 28th, 2010.

In order to remove double or multiple slash from your URL using only .htaccess you can use following code:

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

Written by

Dejan is pragmatic software developer with Master's Degree in Computer Science. He is currently based in Belgrade (Serbia).