Blog Sections Open

Enabling Browser Caching with .htaccess in Evolution CMS

A practical performance note on using Expires headers in .htaccess to improve browser caching for CSS, JavaScript, images, and other static assets.

Browser caching is one of the simplest performance wins you can add to an Evolution CMS project. When static assets stay cacheable for a reasonable period, repeat visits load faster and the server does less unnecessary work.

Why this matters

Services such as Google PageSpeed Insights and hosting diagnostics often warn when CSS, JavaScript, and images are delivered without explicit caching rules. On busy sites that means the browser keeps downloading files that rarely change.

A basic .htaccess example

The original discussion used Apache-style Expires rules similar to the following:

ExpiresActive on
ExpiresDefault "access plus 30 days"
ExpiresByType application/javascript "access plus 30 days"
ExpiresByType text/javascript "access plus 30 days"
ExpiresByType text/css "access plus 30 days"
ExpiresByType text/html "access plus 7 days"
ExpiresByType text/x-javascript "access plus 30 days"
ExpiresByType image/gif "access plus 30 days"
ExpiresByType image/jpeg "access plus 30 days"
ExpiresByType image/png "access plus 30 days"
ExpiresByType image/jpg "access plus 30 days"
ExpiresByType image/x-icon "access plus 30 days"
ExpiresByType application/x-shockwave-flash "access plus 30 days"

Where to place it

Put these rules into the site .htaccess file only after checking whether your host actually allows mod_expires. Some shared environments are fronted by nginx or another proxy layer, and in that case Apache rules may be ignored even if they look correct.

What to verify after deployment

  • use the browser network panel to inspect response headers
  • check whether Expires or Cache-Control is really present
  • confirm that HTML stays on a shorter lifetime than images and CSS
  • make sure deployment and cache-busting strategy match the chosen durations

Practical advice

If your host does not honor these directives, ask support which layer controls caching. The idea is still correct, but the final configuration may need to happen in nginx, a panel setting, or a CDN instead of raw Apache rules.

This is a small optimization, but on real projects it improves repeat page loads and makes every other frontend improvement more effective.

Newer post

Fixing “Cannot modify header information” Errors After Installing EvoGallery

Why “Cannot modify header information” warnings appear after installing EvoGallery on older Evolution builds and how to debug the real output source.

Older post

Troubleshooting eForm Mail Delivery on Hosted Environments

Why eForm mail delivery can fail even when PHP mail works elsewhere, and what to verify first on hosted Evolution CMS projects.