Answers for "disable cache in siteground website"

0

disable cache in siteground website

use the following code in .htaccess

//Disable the cache on a non-WordPress website
<IfModule mod_headers.c>
Header set Cache-Control "private"
</IfModule>

//Exclude a single page from the cache
<If "%{THE_REQUEST} =~ m#/sample-page#">
  <IfModule mod_headers.c>
Header set Cache-Control "private"
</IfModule>
</If>

//Exclude all files of the same type from the cache
<IfModule mod_headers.c>
  <FilesMatch ".(js|css|xml|png|jpg|jpeg|html)$">
    Header set Cache-Control "private"
  </FilesMatch>
</IfModule>

//Exclude a specific file from the cache
<If "%{REQUEST_URI} =~ /filename.php$/">
  <IfModule mod_headers.c>
Header set Cache-Control "private"
</IfModule>
</If>
Posted by: Guest on February-07-2022

Browse Popular Code Answers by Language