SiteGround anti-cache for directory — place in .htaccess within directory and SiteGround won't cache.

01/30/2024
Back to Blogs
# Begin SiteGround Anti-Cache Configuration for Directory
# Author: Knol Aust
# Gist Keywords: siteground, caching, htaccess, performance

# This configuration is intended for use within a specific directory on a SiteGround-hosted website.
# Placing this .htaccess file in a directory will instruct SiteGround's caching mechanisms 
# not to cache any content from this directory. This can be particularly useful for directories 
# containing dynamic or frequently updated content, where caching might lead to stale content being served.

<IfModule mod_headers.c>
    Header set Cache-Control "private"
</IfModule>

# End SiteGround Anti-Cache Configuration