httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pete Nelson" <>
Subject Re: [users@httpd] mod_rewrite advice
Date Tue, 07 Jan 2003 21:02:41 GMT
Thanks for the advice.  I'll be sure to add the Vary: header - I
appreciate the heads-up.

I had looked at a lot of other methods for changing the stylesheet - the
NOCSS var was added specifically for SSI and PHP to change the
stylesheets, and I've used this on other sites as well.  But I'm not
only hiding this from the old browsers, I also need to hide it in such a
way that Dreamweaver & Contribute don't see I'm doing this now.  Using
SSI, the editors brought in both, which worked very poorly, and neither
editor understood the @import rule in a stylesheet (I actually use that
fact to hide my print media stylesheet from them).  Ultimately, this is
a problem with Macromedia's editors, and I've let them know I feel this

I'm just glad we use a powerful server like Apache to make up for all
the problems with browser & editor software.

Pete Nelson, Web Developer

>>> 01/07/03 02:44PM >>>

On Tue, 7 Jan 2003, Pete Nelson wrote:
>    RewriteCond %{REQUEST_URI} !.*-ns4.css
>    RewriteCond %{ENV:NOCSS} =1
>    RewriteCond %{REQUEST_URI} (.*).css
>    RewriteCond %{DOCUMENT_ROOT}%1-ns4.css -f
>    RewriteRule ^(.*)\.css $1-ns4.css
> My question is one of performance.  The first conditution simply tells
> it to quit processing if the request is already for a custom NS4
> stylesheet.  NS4 hits account for only about 2% of our traffic, so the
> second condition immediatly ends the processing for the majority of
> requests.  The 3rd condition ends the processing if the request is NOT
> for a stylesheet, and finally, the 4th condition looks to see if the
> alternate stylesheet exists.
> Is there a better ordering I could be using for these
> Any suggestions welcome.

There is no problem with the ordering.  All tests except the -f will be
very fast, so listing the -f last is the way to go.

But you should be aware of another effect of this configuration: A
User-Agent" header should be getting added to the HTTP response to alert
caches to the browser-dependent content.  (If Apache isn't adding this
header itself, you should add it manually with the Header directive to
assure that the right browsers get the right content.)  This, in turn,
will reduce the cachability of your responses, and make them uncachable
altogether for all the stupid caches that throw out any response with a
Vary: header.

For this reason (among other), many people use other CSS hiding
to trick Netscape 4.  A simple search turns up many ideas:


The official User-To-User support forum of the Apache HTTP Server
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message