Topic: Rewrite matching host AND uri
|

|
| Author |
|
mipstian Newbie

Joined: 21 May 2010
Online Status: Offline Posts: 2
|
| Posted: 21 May 2010 at 4:10pm | IP Logged
|
|
|
I'm trying to get all requests to one of our machines to be rewritten to the
standard www.example url.
we have 2 machines, called w1.example.com and w2.example.com.
my rules right now are:
RewriteCond %{HTTP_HOST} ^w1.example.com$ [NC]
RewriteRule ^(.*) http://www.example.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^w2.example.com$ [NC]
RewriteRule ^(.*) http://www.example.com/$1 [L,R=301]
and they seem to work. but we installed our backoffice only on the w1
machine, so i need to let any requests to ^w1.example.com/backoffice to
go straight through (no redirection)
also, w2 does a redirect to w1 when the backoffice is accessed, so i'm
afraid i could create a redirect loop.
i basically need the same rules i have now, but not firing whenever the uri
starts with /backoffice, and after spending the entire day on
documentation and examples i still couldn't come up with them. so,
please, help :)
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Online Posts: 10489
|
| Posted: 25 May 2010 at 3:56am | IP Logged
|
|
|
Please try to fix your config as follows:
RewriteCond %{HTTP_HOST} ^w1.example.com$ [NC]
RewriteCond %{REQUEST_URI} !^/backoffice [NC]
RewriteRule ^(.*) http://www.example.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^w2.example.com$ [NC]
RewriteRule ^(.*) http://www.example.com/$1 [L,R=301]
__________________ Regards,
Anton
|
| Back to Top |
|
| |
mipstian Newbie

Joined: 21 May 2010
Online Status: Offline Posts: 2
|
| Posted: 25 May 2010 at 8:33am | IP Logged
|
|
|
perfect, thankyou!
|
| Back to Top |
|
| |
|
|
If you wish to post a reply to this topic you must first login
If you are not already registered you must first register
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum
|