exclamation-circleWeb Server: How to disable caching using .htaccess

Topic Rating

28 Oct 2020 12:55 - 28 Oct 2020 13:00 #1 by Trony

After making a change to our Website (css, js, jpg, font, etc.), to make the changes immediate you need to disable the Cache.

With this code at the end of our .htaccess file, we forced a New Browser Session not to cache any files in its cache.

Please note: any previous session will remain in cache and you must clear the Browser Cache manually.

# DISABLE CACHING
<IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires 0
</IfModule>

<FilesMatch "\.(css|flv|gif|htm|html|ico|jpe|jpeg|jpg|js|mp3|mp4|png|pdf|swf|txt)$">
    <IfModule mod_expires.c>
        ExpiresActive Off
    </IfModule>
    <IfModule mod_headers.c>
        FileETag None
        Header unset ETag
        Header unset Pragma
        Header unset Cache-Control
        Header unset Last-Modified
        Header set Pragma "no-cache"
        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
        Header set Expires "Thu, 1 Jan 1970 00:00:00 GMT"
    </IfModule>
</FilesMatch>
Music and Electronic Devices Designer. Drum and Bass Addict. Creative Mind as Lifestyle. Cat in past Life. Soccer, Ice Hockey and Snowboard Lover. Marxist.
Sono Il Re sul Carro Danzante. Attraversando La Città Getto Via I Coriandoli Della Vostra Tristezza Regalando Passione Ed Estasi Nei Vostri Occhi.
Follow Trony on: FusoElektronique | Facebook | Twitter | Google+ | Soundcloud

Attachments:

Last edit: 28 Oct 2020 13:00 by Trony.

Please Log in or Create an account to join the conversation.







Moderators: Trony
Forum ~ Web Server: How to disable caching using .htaccess ~ FusoElektronique Page 1 ~ Title: Web Server: How to disable caching using .htaccess. Category: Computers - WebMastering - Consolle (Design's Factory). Published by: Trony. Date: 28 October 2020. Descrption: After making a change to our Website (css, js, jpg, font, etc.), to make th...
0

You might also be interested...

FusoElektronique - Pure Electronic Music.

Community and Web Radio of Electronic Music since July 2008. Rome, Italy

Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0) 2017.

About us | Our team | Cookie Policy | Privacy Policy | Terms and Conditions | Contact us | Sitemap