Optimize the loading of WordPress sites. Setting Expires headers

The expires Http header tells the browser that after it has downloaded the required file, it does not need to re-download the file for a certain period of time.

Using the expires header allows you to reduce the load on the server, as well as increase the speed of loading pages on your site. This also solves the "Serve static assets with an efficient cache policy" problem in the page load speed check service PageSpeed Insights (apart from third-party files, for example, this will not solve the problem with Google Analytics scripts).

You can configure Expires headers on a WordPress-run site by adding the following directives to the .htaccess file:

# BEGIN EXPIRES 
<IfModule mod_expires.c>
ExpiresActive On 
ExpiresDefault "access plus 10 days"
ExpiresByType text/css "access plus 1 week" 
ExpiresByType text/plain "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month" 
ExpiresByType image/jpeg "access plus 1 month" 
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType application/x-icon "access plus 1 year" 
</IfModule> 
# END EXPIRES

Updated: 19.04.2020

Did this article help you? Rate it!
(No Ratings Yet)
Loading...

Support on Patreon https://www.patreon.com/processby

Leave a Reply

Your email address will not be published. Required fields are marked *

Contacts

E-mail: processby@gmail.com
Skype: inprocess.by
Belarus, Grodno

Send message