I currently have this on my htaccess file to map mydomain.com/contact-us -> mydomain.com/con开发者_开发知识库tact-us.php
RewriteEngine On
RewriteRule ^contact-us(\/?)$ /contact-us.php [NC,QSA,L]
My problem is I want it ALWAYS to show a /
at the end of the URL even if the users did not typed it, currently both with or without slash it will map to mydomain.com/contact-us.php
You could redirect requests to the page without a slash to the page with a slash with a permanent redirect:
RewriteEngine On
RewriteRule ^contact-us$ /contact-us/ [R=301,QSA,L]
RewriteRule ^contact-us/$ /contact-us.php [NC,QSA,L]
精彩评论