2 Quick Tips to Boost Your PageSpeed Insights Score

Google incorporates its PageSpeed Insights into its ranking algorithm. Improve your rank with these quick-wins.

You're missing the boat if you aren't running every single site your own or build through Google's PageSpeed Insights tool. Google has made it clear, from as early as 2010, that page load speed is included in the factors with which its search algorithm uses to rank search results.

What this means for you is that not only does your site have to be optimized for relevance, but it also needs to be optimized for speed. And now with the majority share of internet traffic coming from mobile devices, a fast-loading site is also key to your user experience.

Site optimization can been a difficult job, depending on the platform and server your site is built on. Often a developer is required to help diagnose and fix code-based performance issues.

The good news is that there are a few quick and easy tricks you can use to help improve your score in PageSpeed Insights.

1. Enable GZIP compression

You can reduce the overall file size, and thus download speed, of your site by configuring your server to compress the files it serves before sending them to the browser.

This feature is enabled in most Linux/Apache/MySQL/PHP (LAMP) hosting environments, so it's as simple as dropping a few lines in your .htaccess file at the root of your website directory.

The code we use looks like this, and it can just be added at the bottom of your existing .htaccess file.

AddType application/x-javascript .js
AddType text/css .css

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

In some cases this may not work as planned, and you'll see a 500 error when trying to access your site. Removing the code will bring the site back online. You can contact your host for help if it doesn't work on the first try.

After enabling GZIP compression, running your site through Google PageSpeed Insights should show that your site assets are now compressed (and saving valuable time and bandwidth during the page load).

2. Leverage browser caching

You'll see one of the items PageSpeed checks is whether you are leveraging browser caching. Google's definition of this is pretty strict, requiring your site assets to be cached for a minimum of one week in order to pass this test.

This is definitely not something you want to turn on during development, since you will be forcing your images, fonts, CSS and JavaScript to be cached for a week by the browser—not a good situation for a site still being built.

Again, this is a simple snippet that can be copied and pasted into your site's .htaccess file.


 Header set Cache-Control "max-age=604800, public, must-revalidate"
 Header unset Last-Modified

What's next?

These two tips are quick wins to help you get started on your site speed optimization journey.

From here there are many more techniques you can take advantage of to continue improving your page load speed. After taking these steps, the next techniques we move on to are minifying CSS and JavaScript and optimizing images.

Though there aren't simple drop-in solutions to these issues, modern content management systems, such as Craft CMS and ExpressionEngine, have available tools that will help you take the next steps, so if your site is running one of these systems, or something similar, you may be in luck.