Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Who's an htaccess/redirect expert?
This doesn’t have much to do with Textpattern, but this forum is full of all kinds of experts, so I thought I’d ask this here. I have the following redirects in an htaccess file, and I was wondering if there is a more efficient way to write them:
RewriteCond %{HTTP_HOST} ^napostl.com
RewriteRule (.*) http://www.napostl.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^napostlouis.com
RewriteRule (.*) http://www.napostl.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.napostlouis.com
RewriteRule (.*) http://www.napostl.com/$1 [R=301,L]
It seems like they could/should be consolidated, since they’re all redirecting to the same url, but I tried a couple of things that didn’t work.
Thanks for any helpful hints!
Offline
Re: Who's an htaccess/redirect expert?
nabrown78 wrote:
It seems like they could/should be consolidated, since they’re all redirecting to the same url, but I tried a couple of things that didn’t work.
RewriteCond %{HTTP_HOST} ^napostl.com [OR]
RewriteCond %{HTTP_HOST} ^napostlouis.com [OR]
RewriteCond %{HTTP_HOST} ^www.napostlouis.com
RewriteRule (.*) http://www.napostl.com/$1 [R=301,L]
This should work.
Offline
Re: Who's an htaccess/redirect expert?
Brilliant! Thank you so much, that did the trick.
Offline
Pages: 1