This recipe configures extended cache durations for all images served by your website. Cache-control directives play a central role to instruct browsers how to store and retrieve content. By extending the cache duration for images, website owners can significantly improve website performance, reduce server load, and deliver a faster and more responsive user experience.

Why install this recipe?

Installing this recipe provides multiple benefits:

  • Performance optimization: A longer cache duration for images ensures that users' browsers store these assets for an extended period. Subsequent visits to the website result in faster load times as the images are retrieved locally from the user's cache, reducing server requests.
  • Reduced bandwidth usage: By encouraging browsers to cache images for a longer duration, the recipe minimizes the need for repeated downloads. This translates to reduced bandwidth usage, particularly beneficial for users with limited data plans.
  • Improved user experience: Faster load times contribute to an improved overall user experience, enhancing satisfaction and engagement. Users can navigate the website more seamlessly, leading to higher retention rates.

Cache duration best practices

There are some best practices that can be followed when configuring cache rules for images:

  • Find the right banalance: while a longer cache duration improves performance, striking a balance is crucial. Consider the frequency of image updates on your website; infrequently changing images can have longer cache durations. Browsers and performance tools sometimes advise up to 1 year of cache duration, which is perfectly convenient for images that never change
  • Versioning Strategy: implement a versioning strategy for frequently updated images. Append version numbers or timestamps to filenames to force cache refresh when changes occur - this can also be done as query string parameters to avoid changing filenames

How to install this recipe on my website with redirection.io?

Installing this recipe on your website requires the following steps:

  1. Click on "Install on my website": this will create the necessary cache-control rules for all images
  2. Review the created rule: confirm that the rules accurately reflect the intended configuration
  3. Publish the rules: finalize the installation by publishing the rules on your website.

A few minutes later, your website images will be served using long cache duration headers, contributing to a faster and more efficient website.

Discover our recipes to improve your website's quality in one click

redirection.io's recipes are a powerful feature designed to simplify the implementation of front-end quality best practices for your websites. Think of them as a curated "app store" for your site, offering a variety of pre-configured solutions that can be installed with a single click.

Discover all redirection.io recipes