Welcome to WebmasterWorld Guest from 54.211.86.24

Forum Moderators: Ocean10000 & incrediBILL & phranque

Using mod_rewrite to prevent older browsers from caching a page.

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

10+ Year Member



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]

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

WebmasterWorld Senior Member 10+ Year Member



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

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

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld LukeyBoy! :)

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

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

10+ Year Member



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.

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month