httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Shearer" <j...@shearer-family.org>
Subject Re: [users@httpd] multiple rewrite rules
Date Mon, 07 Dec 2009 06:32:05 GMT
Thanks for your excellent explanation.  

I have used the book "The Definitive Guide to mod_rewrite" by Rich Bowen.  Do you recommend
a different reference?


====================================
Jeff Shearer, CISA, CISSP, IAM, IEM

-----Original Message-----
From: "Krist van Besien" [krist.vanbesien@gmail.com]
Date: 12/06/2009 10:27 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] multiple rewrite rules

On Sun, Dec 6, 2009 at 9:08 PM, Jeff Shearer <jeff@shearer-family.org> wrote:
>  I have been trying without success to rewrite multiple css files with on RewriteCond.
 Here is my latest attempt to give y'all an idea of what I am trying to do.

I have the impression that you are unware how rewriteconds and
rewriterules interact. You can't have one rewritecond apply to many
rewriterules.

Apache always first tests if the LHS of the RewriteRule matches. Then
it will look at any RewriteConds above. It they match than the RHS is
applied.

In order to explain better what happens with your rules I've numbered them:

1>  RewriteCond %{HTTP_USER_AGENT}  .Windows.*Firefox\/3.*
2>  RewriteRule ^/styles/progclean.css
http://progressive.trustedtechpro.com/styles/winff3/progclean.css
3>  RewriteRule ^/styles/terms.css
http://progressive.trustedtechpro.com/styles/winff3/terms.css  [L]
4>  RewriteCond %{HTTP_USER_AGENT}  .MSIE\ 7.*
5>  RewriteRule ^/styles/progclean.css
http://progressive.trustedtechpro.com/styles/winie7/progclean.css
6>  RewriteRule ^/styles/terms.css
http://progressive.trustedtechpro.com/styles/winie7/terms.css  [L]
7>  RewriteRule ^/styles/progclean.css
http://progressive.trustedtechpro.com/styles/unsupported/progclean.css
8>  RewriteRule ^/styles/terms.css
http://progressive.trustedtechpro.com/styles/unsupported/terms.css
[L]

RewriteCond at line 1 only applies to RewriteRule on line 2.
RewriteRule at line 3 does not have  ReweriteCond so all browsers get
http://progressive.trustedtechpro.com/styles/winff3/terms.css. Rules 6
and 8 will even never get triggered...

Have a look at the docs.


Krist

-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

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



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