Linked Questions

Popular Questions

How do I remove trailing slash in redirected URLs?

Asked by At

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 /

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.

Related Questions