Updated on

Remove double trailing slashes

with .htaccess.

I noticed that some referers (most notably Facebook) would sometimes add an extra trailing slash to a URL. This little .htaccess regex removes that, so it keeps your analytics clean:

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

What's next?

Not much really. But if you think this was useful to you, it might be for others also. Feel free to share:

Email, LinkedIn, WhatsApp, or click / push the link below to copy it:

https://eikhart.com/blog/remove-double-trailing-slashes