Add the expires header

Add the expires header

To speed up your WordPress website, it is very useful to add the expires header to the .htaccess file.

With the expires header you tell the browsers that the files that are loaded by your website, will not change for the predefined period. The browser can cache these files en reuse them when the website is revisited.

Caching saves a lot of load time because several files won’t have to be loaded from the web server. Files like images, CSS and Javascript.

With the code below you tell the visitor’s browser which files can be cached and for how long.

To use this code, open the .htaccess file in the root of the WordPress installation. Copy the code and paste this in .htaccess. Save the file on the web server and you’re done. To check the results, you just have to visit your website. You can measure the results with a tool likeĀ GTMetrix.

Always backup the .htaccess before you start changing it!

Ronald Heijnes

Since 2008 I have been busy with the functionality, management, maintenance and performance of self hosted WordPress. I like to share this knowledge!

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz
Close Menu