How to remove trailing slash on URL parameter for SEO friendliness

In .htaccess

RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.+)/$
RewriteRule ^ %{REQUEST_URI}?%1 [R=301,L,NE]

Now all URLs will become

If changing the .htaccess file doesn’t seem to make any difference, make sure that in Apache general config that AllowOverride All is set otherwise .htaccess files will not be interpreted.

Share this article

Share on facebook
Share on twitter
Share on linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top