Author:
Source
Patching .htaccess for SEO
mandclu
Sat, 03/25/2023 – 11:58
Anyone who has ever gone through the process of trying to maximize their site’s Lighthouse or PageSpeed Insights score will have seen suggestions to increase the cache lifetime of static assets: at least 1 year for assets like images and fonts, and at least 1 month for assets like CSS and Javascript files. As noted in the linked page, it is possible to set this cache lifetime site-wide, but if you want to set a shorter cache lifetime for your content than your static assets, we can achieve this with minimal effort.The easiest way to set the cache lifetime for static assets specifically (for sites hosted on Apache webservers) is by modifying Drupal’s default .htaccess file.If you’re hosting your own webfonts (as I recommended in a previous post) you’ll want to define a type for them. Near