Improve Site Load Time Within Minutes
Over the last week or so I’ve been busy working on a new site which I’m planning to put a decent amount of time (and money!) in to. Because of this I spent much more time looking in to how I can improve the site, including page load times. After a bit of research I found 2 simple ways that you can improve your site load times and the best thing is that it literally takes a minute or two.
Firstly I need you to check your sites speed rating with Google. Just type in the URL in there and then click on “Desktop” to see the score. If you see any errors that have a red image beside it then it means that it’s quite important that you try to fix it. There are two big errors that I’m going to tell you how to fix just by adding a bit of code to your .htaccess file. Nobody likes messing around with this file (myself included) but it’s as simple as copying and pasting what’s below so don’t worry about anything going wrong. Even if something does go wrong just go back to the file and delete the code you pasted (but this shouldn’t happen).
Within a minute or two, I got this site from a 61/100 all the way up to a 85/100 which is a massive jump that can only help your sites when it comes to SEO. Just remember that you need to access your .htaccess file to do this, which you can find by using a FTP client like FileZilla – you can’t access this from the WordPress dashboard for example.
Error #1: Enable Compression
If one of the red warnings that you see is “Enable Compression” then you really should fix it. All you’ve got to do to fix this is to enable Gzip, which basically is a server process that makes files smaller before sending them on to whoever visits your site. It compresses pretty much everything, including CSS, HTML etc. In most cases it’ll only use around 30% of the data that your site would normally use, so it saves lots of time for the user as well as saving some bandwidth for yourself. Think of the difference this would make for someone browsing your site on their mobile!
So, how do you do this? Simply copy and paste the code below anywhere in to your .htaccess file.
Error #2: Leverage Browser Caching
To put it simple, you’re telling the browser “this information will stay the same for a year so don’t bother loading it from the server again, as this will just waste your time”. Here’s what you need to add to do this, although you can change a few things around such as “1 year” to “1 month”.
## EXPIRES CACHING ##
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 application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
## EXPIRES CACHING ##
I still get a yellow warning for browser caching after this, but even that is much better than a red warning.
If you’ve done either one of these to a site, check your score again and see what Google gives it out of 100 for page speed. Hopefully this will help some people out! I wish I knew about it before anyway. I’d be interested to hear what kind of changes you’ve seen by getting rid of one or two of these errors if any of your sites had them of course. Let me know in the comment section.