Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x support forum
 Helicon Tech : ISAPI_Rewrite 2.x support forum
Subject Topic: Rule Hierarchy Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
acer152
Newbie
Newbie


Joined: 10 April 2007
Online Status: Offline
Posts: 28
Posted: 28 August 2008 at 7:56am | IP Logged Quote acer152

If I use the same http.ini file for several domains (all having same root), does each rule need to be preceded by the associated RewriteCond Host ...?  Like:

RewriteCond Host: www\.domain1\.com
RewriteRule ...somerule1

RewriteCond Host: www\.domain1\.com
RewriteRule ...somerule2

RewriteCond Host: www\.domain2\.com
RewriteRule ...somerule1


Or, do the rules process in blocks, top down methodology, and only uses rules within the block until a new host is specified:

RewriteCond Host: www\.domain1\.com
RewriteRule ...somerule1
RewriteRule ...somerule2
RewriteRule ...somerule3
RewriteRule ...somerule4

RewriteCond Host: www\.domain2\.com
RewriteRule ...somerule1
RewriteRule ...somerule2
RewriteRule ...somerule3

So domain1 rules and domain2 rule would only be processed by the associated domain.

Back to Top View acer152's Profile Search for other posts by acer152
 
Vyacheslav
Moderator Group
Moderator Group


Joined: 02 July 2008
Location: Ukraine
Online Status: Offline
Posts: 673
Posted: 28 August 2008 at 8:05am | IP Logged Quote Vyacheslav

Hi.
Yes, each rule need to be associated with RewriteCond.

__________________
Kind regards!
Vyacheslav Shinkarenko, HeliconTech.
Back to Top View Vyacheslav's Profile Search for other posts by Vyacheslav Visit Vyacheslav's Homepage
 
acer152
Newbie
Newbie


Joined: 10 April 2007
Online Status: Offline
Posts: 28
Posted: 28 August 2008 at 8:18am | IP Logged Quote acer152

So, does that mean the "blocks" of rules are not correct?

The point being, I don't want the rules for domain1 in first block, to be executed on domain2 in block2. 

Meaning, does the host command persist for all RewriteRule commands until a new host is declared (top-down)?  Or, do you have to specify a host for every RewriteRule line.


Back to Top View acer152's Profile Search for other posts by acer152
 
Vyacheslav
Moderator Group
Moderator Group


Joined: 02 July 2008
Location: Ukraine
Online Status: Offline
Posts: 673
Posted: 28 August 2008 at 9:02am | IP Logged Quote Vyacheslav

You must specify RewriteCond for each RewriteRule. For example:
Code:
RewriteCond Host: ^www\.dom1\.com$
RewriteRule (.*) /dom1-com/$1 [I,L]
RewriteRule (.*) /dom2-com/$1 [I,L]

The 2nd rule matches only if RewriteCond is true, but the 3rd rule matches
for every request, and for every domain.

__________________
Kind regards!
Vyacheslav Shinkarenko, HeliconTech.
Back to Top View Vyacheslav's Profile Search for other posts by Vyacheslav Visit Vyacheslav's Homepage
 
acer152
Newbie
Newbie


Joined: 10 April 2007
Online Status: Offline
Posts: 28
Posted: 28 August 2008 at 9:12am | IP Logged Quote acer152

Arrggh!  Rule blocks would be much cleaner, so the condition carries for all subsequent rules, until new condition is applied. 

But, I suppose there are reasons for why it processes the way you say, so thanks.
Back to Top View acer152's Profile Search for other posts by acer152
 

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