How to force a cache MISS

Chris Wright
Published: 3 November 2023Last updated: 21 July 2026
Share:

You can prevent a webpage from being cached at CDN nodes by setting a cache-control header in a .htaccess file. Our CDN will read this file and apply any rules that have been added. For example, to avoid a webpage caching altogether, you can simply add the following rule into the .htaccess file of the directory of the page being loaded:

# DISABLE CACHING
Header set Cache-Control: no-store

You'll then need to purge the entire cache for the changes to take effect.

To choose specific file types, you can add the following to the same .htaccess instead:

<filesMatch ".(jpg|jpeg|png|gif|ico)$">
Header set Cache-Control: no-store
</filesMatch>

To disable cache for a particular file, i.e. login.php, you can add the following instead:

<Files login.php>
Header set Cache-Control: no-store
</Files>

For multiple files, you'd just add two rules.

<Files login.php>
Header set Cache-Control: no-store
</Files>
<Files hello.php>
Header set Cache-Control: no-store
</Files>

You can also specify certain directory paths not to cache from the main .htaccess file by adding the following rule:

Header always set Cache-Control "no-store" "expr=%{REQUEST_URI} =~ m#^/directory_path#"

Using this rule will result in all files and directories inside the specified directory path to not be cached.