I am using below code in htaccess to remove trailing slash in urls. But after adding this code my admin panel stops working and shows error - Too many redirects. I don't know whether to place this code within any IfModule block or not.

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

Please provide a solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.