By default, all files will have a cache lifetime of only 7 days because that's what's set in the .htaccess
file. It would be great if we could specify a longer lifetime for static assets.
Here is the recommended code from AdvAgg for Drupal:
<FilesMatch "^(css|js)__[A-Za-z0-9-_]{43}__[A-Za-z0-9-_]{43}__[A-Za-z0-9-_]{43}.(css|js)(\.gz|\.br)?">
# No mod_headers. Apache module headers is not enabled.
<IfModule !mod_headers.c>
# No mod_expires. Apache module expires is not enabled.
<IfModule !mod_expires.c>
# Use ETags.
FileETag MTime Size
</IfModule>
</IfModule>
# Use Expires Directive if apache module expires is enabled.
<IfModule mod_expires.c>
# Do not use ETags.
FileETag None
# Enable expirations.
ExpiresActive On
# Cache all aggregated css/js files for 52 weeks after access (A).
ExpiresDefault A31449600
</IfModule>
# Use Headers Directive if apache module headers is enabled.
<IfModule mod_headers.c>
# Do not use etags for cache validation.
Header unset ETag
<IfModule !mod_expires.c>
# Set a far future Cache-Control header to 52 weeks.
Header set Cache-Control "max-age=31449600, no-transform, public"
</IfModule>
<IfModule mod_expires.c>
Header append Cache-Control "no-transform, public"
</IfModule>
</IfModule>
</FilesMatch>
GitHub Issue #:
3937
Recent comments
Congratulations for solving this on your own. Please, keep using the forum to ask questions. Maybe next time, we'll be able to help you before you figure it out on your own.
Error on Search Results
Solved. There was a function in my template file that made attachments automatically open in another window. Still have to figure out why it was giving Bd such a problem but… I also still don't...
Error on Search Results
More weird…I can search Boo and Poo, they work…Too does not :? or any other word I've tried.
Error on Search Results