Showing results for 
Search instead for 
Did you mean: 

Removing or redirecting trailing slash

Removing or redirecting trailing slash

We want to avoid duplicate content so being consistent on the trailing slash or non-trailing slash is an issue we need to fix. We would like to remove the trailing slash but I'm having issues with this working.


We are using Magento 2 but also just realized we have php version 5.3.26 and not the recommended 5.5+. Not sure if that's it or not.


I've tried this (

# remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} \s(.+?)/+[?\s]
RewriteRule ^(.+?)/$ /$1 [R=301,L]

 but then we cannot add items to the cart, it just spins and spins.


Is there any other way I might go about removing the trailing slash in Magento 2?