[KLUG Members] apache question

bill members@kalamazoolinux.org
Mon, 15 Dec 2003 16:11:02 -0500


Adam Williams wrote:

>>The solution might be as simple as holding down your shift key when you 
>>hit "Reload" on your browser, which forces it to get a fresh copy from 
>>the server.
>

This usually forces a fresh load of images too.

If you've visited the site and seen
>>the page before, have you tried just adding an extra GET value to the url?
>>http://mysite.com/mypage.html?killcache=1234
>>Then just keep changing the 1234 to some other number to keep seeing the 
>>newest version of the page.
> 
> 
> The above will work, but might not help any references images that have
> changed.

In which case, repeat the first trick.

Although it is unlikely helpful for Rusty's problem, you can force a 
fresh load of every image every time by generating a changed number 
(e.g., UNIX time stamp) and adding it as a GET value to the image tag in 
the html

e.g.,

IMG src="http://mysite.com/myimage.jpg?killcache=1234567890"

Have your dynamic script (using e.g., PHP) write the new number every 
time the page is viewed.

<?php
$c=time();
echo "<img src=\"http://mysite.com/myimage.jpg?killcache=$c\">";
?>

Apache will happily pass along the useless GET request but any cache 
will think it is a different image and load it fresh.

kind regards,

bill