How to speed up your site by remote caching static content

Even though almost all sites are dynamic nowadays they still serve a lot of static content. Static content is content that is not generated on the fly and does not change often, i.e. all graphics, videos and most importantly site css and javascripts.

If your visitors come back often to your site it makes sense to instruct their browsers to keep the static content locally for a certain period of time and re-use it. For this purpose we can use Apache mod_expires. It can be enabled in a local .htaccess file where you can specify all of its rules too.

Here is an example:

 

 

The above rules give specific expiration periods for each content type such as text, images, css etc. The counter starts when the content is accessed once and then to it is added certain predefined period resulting in expiration date. Only after this expiration date the remote browser is supposed to re-download the content unless the user clears browser cache manually.

Caching static content at visitors' end with mod_expires can significantly speed up your site and decrease the server load. Static content is usually the largest and slowest to download. Enabling mod_expires can be very useful especially to forums, chats or other sites where same users revisit them often.

You find this article useful? Click here to learn more about Hostlantern web hosting experts and what else we can do for you!

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

File downloads from my site do not complete

The reasons for such problems vary and if you search the web for 'corrupted downloads' you will...

Common reasons for a site to load slowly

The time for loading a web site depends mostly on: 1. The number / size of external resources...

Powered by WHMCompleteSolution