I use this redirect for specific URLs to remove the .php
extension and it works, but adds trailing slash at the end of each redirected URL. How do I remove that trailing slash only from the redirected URLs in this rule:
RewriteEngine On
RewriteBase /
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^(about|contact)(\.php)?$ /$1/ [R=302,L]
RewriteRule ^(about|contact)/$ $1.php [END,QSA,NC]
I tried adding this rule RewriteRule (.*)/$ $1 [R=301,L]
additionally, but I get an error on those same pages.