Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable Apache caching in Apache-XAMPP?

I am having this weird problem with my XAMPP-Apache. I am making an log-in system where form is posted to redirect.php page. I updated the redirect.php and but still it is showing me the same old result. There is not even a single line to redirect(header fn call) it to another page but still it redirects to home.php page as it was doing in older script. I tried clearing cache of my browser and changing the browser for testing but didn't work...I even tried rebooting the server but no change. Please help me through....

like image 752
Dhananjay Avatar asked Jun 01 '12 09:06

Dhananjay


2 Answers

Tried this? Should work in both .htaccess, httpd.conf and in a VirtualHost (usually placed in httpd-vhosts.conf if you have included it from your httpd.conf)

<filesMatch "\.(html|htm|js|css)$">
  FileETag None
  <ifModule mod_headers.c>
     Header unset ETag
     Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
     Header set Pragma "no-cache"
     Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
  </ifModule>
</filesMatch>

100% Prevent Files from being cached

This is similar to how google ads employ the header Cache-Control: private, x-gzip-ok="" > to prevent caching of ads by proxies and clients. From http://www.askapache.com/htaccess/using-http-headers-with-htaccess.html

And optionally add the extension for the template files you are retrieving if you are using an extension other than .html for those.

like image 100
Siddhesh Avatar answered Sep 19 '22 17:09

Siddhesh


If request is identical, it's possible that you receiving response from cache.

Solution 1:

You can try to have every time unique request by adding for example time stamp.

Solution 2 (not every server will accept - depend on server setting):

You can set header params to your request like:

'If-Modified-Since' = 'Mon, 26 Jul 1997 05:00:00 GMT'
'Cache-Control' = 'no-cache'
'Pragma' = 'no-cache'

Solution 3:

Play with server config :)

like image 28
xboomx Avatar answered Sep 17 '22 17:09

xboomx