Speed website by adding browser cache

→ Are you a new visitor? Please visit the page guidance for new visitors ←

There are some easy things that you can do to speed up a website by making use of the browser cache. Using the browser cache you can also reduce the load on your web server.

Normally the modules that we would use are mod_expires and mod_headers which are normally installed by default and just need to be enabled.

You can do this very easily using the bellow commands:

  • Ubuntu/Debian based OS

  • Centos/Fedora/Redhat

For these OS’s you usually have these already installed/enabled by default. You can also use the command to check the enabled modules:

These settings can be set directly inside the apache web server configuration or by setting the values inside the .htaccess file in the root of your website.

Examples off similar configuration that can be used are:

  • mod_expires + mod_headers

headers
You can also use just the mod_expire or mod_headers separately like in the bellow example:

  • mod_headers

  • mod_expires

It is very good to rely on browser cache whenever possible. You can easily add these settings in your .htaccess file directly, although some hosting providers will use the above settings for you by default.

Request an article ←