multiple rewrite rules

multiple rewrite rules

am 06.12.2009 21:08:40 von Jeff Shearer

I have been trying without success to rewrite multiple css files with on Re=
writeCond. Here is my latest attempt to give y'all an idea of what I am try=
ing to do. =


Please help.

Thanks.

RewriteEngine on
RewriteLog /var/log/httpd-rewrite.log
RewriteLogLevel 2
RewriteCond %{HTTP_USER_AGENT} .Windows.*Firefox\/3.*
RewriteRule ^/styles/progclean.css http://progressive.trustedtechpro.c=
om/styles/winff3/progclean.css
RewriteRule ^/styles/terms.css http://progressive.trustedtechpro.com/s=
tyles/winff3/terms.css [L]
RewriteCond %{HTTP_USER_AGENT} .MSIE\ 7.*
RewriteRule ^/styles/progclean.css http://progressive.trustedtechpro.c=
om/styles/winie7/progclean.css
RewriteRule ^/styles/terms.css http://progressive.trustedtechpro.com/s=
tyles/winie7/terms.css [L]
RewriteRule ^/styles/progclean.css http://progressive.trustedtechpro.c=
om/styles/unsupported/progclean.css
RewriteRule ^/styles/terms.css http://progressive.trustedtechpro.com/s=
tyles/unsupported/terms.css [L]

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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

Re: multiple rewrite rules

am 07.12.2009 01:34:05 von aw

Jeff Shearer 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.
>
> Please help.
>
> Thanks.
>
> RewriteEngine on
> RewriteLog /var/log/httpd-rewrite.log
> RewriteLogLevel 2
> RewriteCond %{HTTP_USER_AGENT} .Windows.*Firefox\/3.*
> RewriteRule ^/styles/progclean.css http://progressive.trustedtechpro.com/styles/winff3/progclea n.css
> RewriteRule ^/styles/terms.css http://progressive.trustedtechpro.com/styles/winff3/terms.cs s [L]
> RewriteCond %{HTTP_USER_AGENT} .MSIE\ 7.*
> RewriteRule ^/styles/progclean.css http://progressive.trustedtechpro.com/styles/winie7/progclea n.css
> RewriteRule ^/styles/terms.css http://progressive.trustedtechpro.com/styles/winie7/terms.cs s [L]
> RewriteRule ^/styles/progclean.css http://progressive.trustedtechpro.com/styles/unsupported/pro gclean.css
> RewriteRule ^/styles/terms.css http://progressive.trustedtechpro.com/styles/unsupported/ter ms.css [L]
>
What seems to be missing above is :
- what is the hostname of the server on which you do the above ? is it
also "progressive.trustedtechpro.com" ?
- what is the problem ?


------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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

Re: multiple rewrite rules

am 07.12.2009 07:26:56 von Krist van Besien

On Sun, Dec 6, 2009 at 9:08 PM, Jeff Shearer wrot=
e:
> =A0I have been trying without success to rewrite multiple css files with =
on RewriteCond. =A0Here 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> =A0RewriteCond %{HTTP_USER_AGENT} =A0.Windows.*Firefox\/3.*
2> =A0RewriteRule ^/styles/progclean.css
http://progressive.trustedtechpro.com/styles/winff3/progclea n.css
3> =A0RewriteRule ^/styles/terms.css
http://progressive.trustedtechpro.com/styles/winff3/terms.cs s =A0[L]
4> =A0RewriteCond %{HTTP_USER_AGENT} =A0.MSIE\ 7.*
5> =A0RewriteRule ^/styles/progclean.css
http://progressive.trustedtechpro.com/styles/winie7/progclea n.css
6> =A0RewriteRule ^/styles/terms.css
http://progressive.trustedtechpro.com/styles/winie7/terms.cs s =A0[L]
7> =A0RewriteRule ^/styles/progclean.css
http://progressive.trustedtechpro.com/styles/unsupported/pro gclean.css
8> =A0RewriteRule ^/styles/terms.css
http://progressive.trustedtechpro.com/styles/unsupported/ter ms.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.cs s. Rules 6
and 8 will even never get triggered...

Have a look at the docs.


Krist

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