Reputation: 11
What is the correct way to write out the .htacess so that both www.domain.com/about_us and www.domain.com/about_us/ goes to www.domain.com/about_us.php
Currently, what I have is the below and just wonder if there's a way to put it in one line
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(about)$ /about_us.php
RewriteRule ^(about/)$ /about_us.php
Upvotes: 1
Views: 847
Reputation: 2192
It's a regular expression, so adding ? after the / will make the / optional (0 or 1 occurrences). Also, the parenthesis are unnecessary:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^about/?$ /about_us.php
Upvotes: 3