Speed up your website using browser caching
- 29 March 2017
- 14:33:00
- 1659 views
To speed up your website, it is possible to make use of browser caching. You can instruct your visitors browser to, for example, only check changes in jpeg-files once every month. By default this is not enabled on our shared hosting packages, but you can easily turn it on for your own website.
Create a new file called .htaccess in the httpdocs folder of your website, containing the lines below. If you already have an existing .htaccess file, you can add these lines to it:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType image/gif "access 1 month"
ExpiresByType image/png "access 1 month"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 month"
ExpiresDefault "access 1 month"
</IfModule>
Ofcourse it is possible to change the cache times as desired, or remove rules. For example, if you do not wish to cache PNG files, remove the line containing image/png