How to disable Apache caching in Apache-XAMPP?
Solution 1
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.
Solution 2
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 :)
Dhananjay
Updated on June 10, 2021Comments
-
Dhananjay about 3 years
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....
-
JonyD about 7 years@Micha answering your question: in the file /opt/lampp/etc/httpd.conf look for the line "LoadModule cache_module modules/mod_cache.so" and add a # in the beginning of the line. save the file and restart the apache server.
-
JonyD about 7 yearsI had also to comment the line "cache_disk_module modules/mod_cache_disk.so" because apache was complaining about it in the log, refusing to start.
-
Siddhesh about 7 years@cascading-style Kindly accept the answer. I need the bounty ;)