skip to Main Content

I am facing the following problem: I am developing locally on my machine, and after making certain changes, I upload them to the remote Git directory. Then, I download them on my server, which is running Apache on Ubuntu 22.04 LTS. The files are downloaded, and when opened with nano i can see that my changes are there, but the old version of the file continues to be displayed when I access the page.

I’ve tried restarting Apache and even rebooting the server, but nothing has worked. I also created a .htaccess file to override the caching, but that didn’t help either.

2

Answers


  1. Check if your Apache server has any caching mechanisms enabled. Look for modules like mod_cache, mod_expires, or mod_headers in your Apache configuration files. If you find any caching directives in your Apache configuration, try disabling them or adjusting the cache expiration settings.

    Ensure that your .htaccess file is correctly configured to disable caching. You can use the following directives:

    <FilesMatch ".(html|htm|js|css|php)$">
        FileETag None
        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"
    </FilesMatch>
    
    Login or Signup to reply.
  2. Apache generally attaches caching info, so proxies and browsers can cache. So apache is not caching, only telling your browser to cache. To overcome this

    1. Disable apache caching info @Giuseppe mentioned in their answer
    2. Append random string when calling file like ie if your file is index.html you can call http://example.com/index.html?123
    3. use wget to check file.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search