logo

sign-up-for-free-cybersalt-today-button

.htaccess code for not caching pagesI'm no genius about computer servers - a fact quite clear even to people who themselves are not server geniuses.

So when I recently wanted to experiment to discover the reason my web pages were serving up super slow I asked my web host what code I could add to my .htaccess file in order to tell the server to not cache any element of my site. Here is what he gave me:

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"

I can't really describe the type of server or set-up that the above code works on, but I've put it here so that anyone trying to keep their web pages from being cached on a server have one more thing to try.  I am also putting it here so I know where to look for it should I need it again in the future.

BTW, after my trial of the code above, I removed it once it was clear my slow page load speed was not due to the caching on the server. I know that sounds odd since caching is done for speed improvements, but like I said I was troubleshooting.

Powered By JFBConnect