I have my htaccess configured to work in conjunction with a URL Router I\'ve written in PHP. I\'m trying to remove a trailing slash if seen from the URL except the root url
Insert this rule just below RewriteEngine On
:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)/$ /$1 [R=302,NE,L]
For those who are still running into this problem, I solved mine by adding a question mark just after the slash before the dollar sign, like this:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)/?$ /$1 [R=302,NE,L]