Robot Portal

Easily manage all aspects of your account | Knowledgebase |

Knowledgebase

Disable caching with .htaccess

Quick .htaccess snippet to disable browser caching by modifying Cache-Control, Pragma, and Expires headers. Strictly plug-n-play.

Just add the following directives to your site’s root .htaccess file:

# 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>

No editing required. I use this technique on several of my sites and it works like a charm. You can verify that it works using any number of freely available online tools, and/or any browser extension that displays header/server response.

Updates

Update #1: Here is another line that you can play with:

Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"

Update #2: Here is another technique for caching static resources while optimizing performance (You can customize the list of file types to suit your specific needs)

<FilesMatch "\.(css|flv|gif|htm|html|ico|jpe|jpeg|jpg|js|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 "Mon, 10 Apr 1972 00:00:00 GMT"
</IfModule>
</FilesMatch>

  • 23 Users Found This Useful

Was this answer helpful?

Related Articles

500 Internal Server Error

Internal Server Error help, 500 error Internal server errors can be caused by a few different...

Do you provide AwStats?

Yes, we provide AWSTATS most of the servers of CentrioHost Networks and it is updated...

Register_Global ON?

Since register_globals is disabled on the servers for security purposes, some of your scripts and...

Unable to Access my site?

We receive lots of queries from our client saying that why i'm not being able to access my site....

How to change a php.ini value?

We use suPHP in all of our servers. So you can modify your php.ini value very easily! All you...

Over 20000 Satisfied Customers!

  • web hosting reviewer
    Valerie Quinn
    CTO, Acteon Group

    Centriohost staff were fantastic, I had a concern with a domain and they got back to me very quickly and they helped me to resolve the issue! ~ . . . Read more

  • Joomla hosting reviewer
    Collin Bryan
    Photographer, Allister Freeman

    I'm using centrio for my portfolio since 2006. The transition was seamless, the support was immediate, and everything works perfectly. ~ . . . Read more

  • dedicated server reviewer
    Harry Collett
    Actor, A&J Artists

    Very easy to understand & use even though I am not very technologically minded. No complications whatsoever & I wouldn't hesitate to recommend it to all. ~ . . . Read more

  • vps web hosting reviewer
    Porfirio Santos
    Technician, Diageo PLC

    Centrio support team have been amazingly responsive and helpful to any of my queries, thank you so much to the Centriohost have been amazingly responsive and helpful to any of my queries πŸ‘πŸ‘πŸ‘ ~ . . . Read more

  • wordpress hosting plans reviewer
    Catherine Auer
    Doctor, SmartClinics

    Anytime I've had a problem I can't solve, I've found Centriohost to be diligent and persistent. They simply won't let an issue go until the client is happy. ~ . . . Read more

  • reseller hosting reviewer
    Effectivo Social
    Freelancer, Fiverr

    Recommend their shared hosting for all my SME web design clients. Their cloud or VME offerings are too great to deal with. Pricing is perfect and suitable for all users (Ν β‰– ΝœΚ–Ν β‰–) πŸ‘Œ ~ . . . Read more