Remove double trailing slashes with .htaccess

I noticed that some referers would sometimes add an extra trailing slash to a URL.

This little .htaccess regex removes that, so it keeps your analytics clean. It basically says: "check the URL that is requested. If a double slash is found, replace it with a single slash." Easy peasy.

RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
Menu
Published: June 7, 2018 ~ 1 min.
Home  »  Blog  »  Remove double trailing slashes with .htaccess

Eikhart - Mad Scientist