httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Gushlow <nick.gush...@westcoast.co.uk>
Subject RE: [users@httpd] Rewrite If Statements
Date Wed, 23 Feb 2005 16:33:33 GMT
On Wed, 2005-02-23 at 16:20 +0100, Boyle Owen wrote:

> You can achieve this using the "S" flag to the RewriteRule. This causes
> mod_rewrite to "skip" the next N rules. For example:
> 
> if (condition_1)
> 	rule_1
> else
> 	rule_2
> 
> is implemented by:
> 
> RewriteCond condition_1
> RewriteRule rule_1 [S=1]
> RewriteRule rule_2
> 
> This is the fundamental logic element (if-then-else). Note that this
> just allows a two-way switch. It doesn't give you the full multiplex
> switching (case-statement) that you might need. You might get away with:
> 
> RewriteCond condition_1
> RewriteRule rule_1
> 
> RewriteCond condition_2
> RewriteRule rule_2 [S=1]
> RewriteRule rule_3
> 
> so long as condition_1 and condition_2 are mutually exclusive (ie, can't
> both be true).

Ah ok, that looks like what I need; wasn't sure I could separate
conditions and rules.


Thanks,

Nick.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message