# SEO Auditor Tools — Apache static asset expiry headers
#
# Copy this block into the WordPress root .htaccess file when Apache or
# LiteSpeed is used. Back up .htaccess first. Nginx users must add equivalent
# rules to the server block instead; .htaccess is not read by Nginx.

# BEGIN SEO AUDITOR STATIC ASSET CACHE
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"

# Styles and scripts (use versioned filenames or query strings)
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType application/wasm "access plus 1 year"
ExpiresByType application/manifest+json "access plus 1 month"

# Raster and vector images
ExpiresByType image/avif "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType image/bmp "access plus 1 year"
ExpiresByType image/tiff "access plus 1 year"

# Fonts
ExpiresByType font/woff2 "access plus 1 year"
ExpiresByType font/woff "access plus 1 year"
ExpiresByType application/font-woff "access plus 1 year"
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType font/ttf "access plus 1 year"
ExpiresByType font/otf "access plus 1 year"

# Audio and video
ExpiresByType audio/mpeg "access plus 1 year"
ExpiresByType audio/ogg "access plus 1 year"
ExpiresByType audio/wav "access plus 1 year"
ExpiresByType video/mp4 "access plus 1 year"
ExpiresByType video/webm "access plus 1 year"
ExpiresByType video/ogg "access plus 1 year"

# Documents and feeds — shorter because content can change without a new URL
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType application/json "access plus 1 day"
ExpiresByType application/xml "access plus 1 day"
ExpiresByType text/xml "access plus 1 day"
ExpiresByType application/rss+xml "access plus 1 hour"
ExpiresByType application/atom+xml "access plus 1 hour"
</IfModule>

<IfModule mod_headers.c>
<FilesMatch "\.(?:avif|webp|jpe?g|png|gif|svg|ico|bmp|tiff?|css|js|mjs|wasm|woff2?|ttf|otf|eot|mp3|ogg|oga|wav|mp4|webm|ogv|webmanifest)$">
Header set Cache-Control "public, max-age=31536000, immutable"
</FilesMatch>
<FilesMatch "\.(?:pdf|json|xml|rss|atom)$">
Header set Cache-Control "public, max-age=86400, must-revalidate"
</FilesMatch>
</IfModule>
# END SEO AUDITOR STATIC ASSET CACHE
