homepage Welcome to WebmasterWorld Guest from 54.204.215.209
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Using mod_rewrite to prevent older browsers from caching a page.
LukeyBoy




msg:1516712
 5:57 am on Apr 14, 2003 (gmt 0)

Like the title says... Netscape/4 never properly revalidates it's cached copy, and the people hitting my site have to hit Shift-Reload each time. What I want to do is detect that version of Netscape (or rather any version previous to the current Mozilla series) and add a No-Cache header to the output. Can anyone give me some pointers in this? Thanks!

--
Luke Reeves
URL snipped

[edited by: DaveAtIFG at 4:22 pm (utc) on April 14, 2003]

 

carfac




msg:1516713
 4:20 pm on Apr 14, 2003 (gmt 0)

For a single page, or a whole site?

For a single page, it might be easy to impliment, as you can redirect to a copy of the one page with the additional "NO_CACHE" in the header.

For a whole site, you would probably be best to use SSI or some template-driven solution so that mod_rewrite could just set a flag (netscape=4, for instance) and then just have an if netscape=4 print no-cache in the same set of pages.

Make sense?

dave

DaveAtIFG




msg:1516714
 4:37 pm on Apr 14, 2003 (gmt 0)

Welcome to WebmasterWorld LukeyBoy! :)

Here's [mnot.net] a pretty good tutorial on caching.

LukeyBoy




msg:1516715
 12:02 am on Apr 15, 2003 (gmt 0)

Hmm, thanks. I understand the caching, but don't really want to have to touch any HTML - to me the mod_rewrite solution would be much cleaner. I'd like to check for the Netscape 4-series user-agent, and then add the corresponding Cache-Control headers to prevent only that browser from caching content.

For example, the default Apache config file comes with a set of directives to automatically disable persistent HTTP connections for user-agents such as RealPlayer and a specific version of the Java runtime - this is close to what I want.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved