The time that web pages take to load increases because static resources must be downloaded over the network. These resources can be cached by the browser using HTTP caching. Once a resource is cached, the browser loads the stored copy instead of downloading it again, reducing page load time.
Browser caching helps reduce the total payload size, saves bandwidth, and eliminates repeated HTTP requests for the same resources.
Cacheable resources include JavaScript and CSS files, image files, and other binary objects such as media files and PDFs. HTML files are usually dynamic and should be cached carefully, typically for shorter durations.
In Apache, browser caching is handled using the mod_expires and mod_headers modules, which control cache behavior through HTTP headers sent by the server.
Example Apache Expires Configuration
Explanation
- ExpiresDefault “access plus 2 days” sets a default cache duration of two days for all content types
- ExpiresByType image/jpeg “access plus 1 year” tells the browser to cache JPEG images for one year
- Static files that rarely change can be cached for longer periods
- Frequently updated resources should have shorter expiration times
By properly configuring browser caching, you can significantly improve website performance and user experience.
If you require help, contact SupportPRO Server Admin
