Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Rewrite matching host AND uri Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
mipstian
Newbie
Newbie


Joined: 21 May 2010
Online Status: Offline
Posts: 2
Posted: 21 May 2010 at 4:10pm | IP Logged Quote mipstian

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 View mipstian's Profile Search for other posts by mipstian
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Online
Posts: 10489
Posted: 25 May 2010 at 3:56am | IP Logged Quote Anton

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 View Anton's Profile Search for other posts by Anton
 
mipstian
Newbie
Newbie


Joined: 21 May 2010
Online Status: Offline
Posts: 2
Posted: 25 May 2010 at 8:33am | IP Logged Quote mipstian

perfect, thankyou!
Back to Top View mipstian's Profile Search for other posts by mipstian
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
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