SUMMARY: OT: Apache mod_rewrite rule

From: Chris Denneen <sunmanagers_at_ghostspace.com>
Date: Tue Sep 09 2003 - 15:37:47 EDT
Answer:

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


-- 
Cheers, Chris


Quoting Chris Denneen <sunmanagers@ghostspace.com>:

> 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
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Tue Sep 9 15:42:26 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:19 EST