Reputation: 33956
For some reason some links create slashes at the end of urls. I discovered the same link in a different device can or cannot add a slash at the end of the URL.
Due to my htaccess structuring I sometimes get errors if the URLs have slashes. Is there a way to remove them from URLs with htaccess?
EG:
example.com/s/
instantly redirects to:
example.com/s
Upvotes: 0
Views: 827
Reputation: 1514
This do the job and you don't need to specify the domain :
RewriteRule ^(.+)/$ /$1 [R=301,L]
Upvotes: 0
Reputation: 6276
A similar question gave this answer:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} (.*)$
RewriteRule ^(.+)/$ http://www.domain.com/$1 [R=301,L]
Upvotes: 1