Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-11-18 19:47:52

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

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

#2 2008-11-18 22:27:34

graeme
Plugin Author
Registered: 2004-06-21
Posts: 337
Website

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

#3 2008-11-18 22:38:01

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

Re: Who's an htaccess/redirect expert?

Brilliant! Thank you so much, that did the trick.

Offline

Board footer

Powered by FluxBB