Skip to content

Quick Tip: prevent caching of resources using .htaccess

A quick and easy way to prevent specific resources from being cached by sending the correct headers in .htaccess file.

For example, in the code below, we want that our HTML, JS and CSS files won’t be cached. This can be useful when you’re developing a site and want everything to refresh when you reload the page.

Those headers also come in useful when your site is behind a proxy, such as CloudFlare, and have little control over what gets cached and what doesn’t.

Put this code below in your .htaccess file (and of course change or add other file types)

 

 

 

Leave a Reply