Improve WordPress speed by modifying browser caching

When a user starts loading your website, his browser immediately starts downloading all the necessary files from a server on which your website is located. Depending on user’s internet connection speed and server capabilities, the site can be loaded faster or slower. Of course, each party wants to load the site as fast as possible and you, as an admin, have to do all in your power to make your site lightning fast.

Improve WordPress speed and cache static files longer

That first visit to your site is dependent entirely on the internet connection and the server, but you can make the change for your regular visitors. They probably won’t be aware that the changes are done, but they will always have in mind how fast your site really is. You can put yourself in their shoes – if the sites take seconds to load each page, you probably won’t be sticking around for too long no matter how good the content is, right?

Caching technology takes some of the files from the server and stores them on a local computer. Then, if a user visits the same site again, the browser will check for stored files and will load them instantly instead of downloading them from the remote server once again. This makes loading time much shorter, improves WordPress speed and that makes a visitor much happier.

By using the following code, you can tell WordPress to cache static files for a longer period of time. Before you run to copy and paste the code, take a minute to reconsider– how often do you make changes to your website, what kind of content do you have and can this really help your site if you prolong caching?

    1. Open .htaccess file
    2. Copy and paste the following:
# Browser Caching
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "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 year"
ExpiresDefault "access 2 days"
</IfModule>
  1. Save changes

After you save changes, your server will change access time for storing those files locally. If you’re not comfortable modifying .htaccess file by yourself, you can do the same by using a simple plugin.

START YOUR OWN BLOG

This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

Leave a Reply

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