OT: Apache mod_rewrite rule

From: Chris Denneen (sunmanagers@ghostspace.com)
Date: Tue Sep 09 2003 - 14:03:34 EDT


All,

I need to setup a rewrite rule for ONLY a particular host request.

Now for example I have 3 DNS names going to the same IP address and serving the
same content.

Host1.mydomain.com
Host2.mydomain.com
Host3.mydomain.com

Now..

The default mod_rewrite rule I would use when I want to Rewrite to
Host2.mydomain.com is:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^Host2.mydomain.com(:80)?$
RewriteRule ^/(.*) http://Host2.mydomain.com/$1 [L,R]
RewriteOptions inherit

This would work but I don't want to change Host3.mydomain.com

Host1.mydomain.com needs to rewrite to Host2.mydomain.com
Host2.mydomain.com can stay the same
Host3.mydomain.com needs to be left alone.

Do do this I need to modify the:

RewriteCond %{HTTP_HOST} !^Host2.mydomain.com(:80)?$

and replace the "%{HTTP_HOST}" part with Host1.mydomain.com but I can't seem to
figure out the correct syntax.

Also further:

I want to rewrite Host1.mydomain.com -> Host2.mydomain.com for everything except
1 directory.

If the request is for http://Host1.mydomain.com/mydir I want to NOT rewrite this
to Host2.mydomain.com

Can you guys help here.

Thanks

-- 
Cheers, Chris
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers


This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:27:05 EDT