Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable cache of Apache?

Tags:

caching

apache

I put only index.html in /var/www/html. The page doesn't update after I changed the contents of index.html and reload.

I already disable cache_module in httpd.conf like this below.

# LoadModule cache_module modules/mod_cache.so
# LoadModule disk_cache_module modules/mod_disk_cache.so
like image 959
morizotter Avatar asked Apr 06 '14 09:04

morizotter


People also ask

Does Apache have cache?

The Apache HTTP server offers a low level shared object cache for caching information such as SSL sessions, or authentication credentials, within the socache interface. Additional modules are provided for each implementation, offering the following backends: mod_socache_dbm. DBM based shared object cache.

How do I disable caching in htaccess?

htaccess is that it reads intructions from top to bottom. If an instruction at the top is contradicted by one farther down, the last one to be read will be the one that is used. This allows us to turn off caching without disurbing any existing instructions simply by putting new instructions at the bottom.

How do I disable cache in xampp?

@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.


1 Answers

if you are using htaccess then you can do like

#Initialize mod_rewrite
RewriteEngine On
<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, 12 Jan 1980 05:00:00 GMT"
  </IfModule>
</FilesMatch>
like image 60
user3470953 Avatar answered Oct 13 '22 21:10

user3470953