How To Set Up Google PageSpeed Service With WordPress

Recently Andrew over at We Build Your Blog let me know that Google’s PageSpeed Service was now available for website owners to use.

What is Google PageSpeed Service?

It’s a service that essentially takes your website, optimizes it for speed and then serves it back to readers seamlessley. This video explains more:

How do I get it?

At the time of writing it’s invite only, but invites appear very quickly after applying.

1) Go over to https://developers.google.com/speed/pagespeed/service and sign up.

2) Once approved you will get an email with your access link.

3) Click on Add New Domain and the box will expand

google-pagespeed2

4) Enter your URL in there and press add. Note that the URL needs to have www. in it. If your site doesn’t use www in the URL you will need to change it to, see below for instructions.

5) You need to make a CNAME change in your domain. Usually this is in your web host. So if your webhost has cPanel, login and go to Advanced DNS Zone Editor (in the domain section). Select your domain from the dropdown and once the Zone File Records section opens find the row that looks like

www.domain-name.com. 14400 IN CNAME domain-name.com

where domain-name is your website domain name. Click the Edit to the right and change the Record to be pagespeed.googlehosted.com instead. So the record now looks like:

www.domain-name.com. 14400 IN CNAME pagespeed.googlehosted.com

Messing this up can break your site, but if you get any errors with your website just change it back to the domain name and your site will work again.

6) That’s it! Check your site is still working. Then back in your PageSpeed Service Overview (where you added the domain in step 3) you can run a speed test and it will show you how much time has been taken off your loading time.

The below is only needed if your site doesn’t have www in it.

google-pagespeed1

Changing your site to use www

There are three steps in WordPress to adding in www to your URL if you don’t have it.

1) In WordPress itself go to Settings > General and add in www.

2) In your .htaccess file in the root folder of your website, add in the following. Please, please make a backup of .htaccess first as any wrong move can break your site.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain-name\.com
RewriteRule (.*) http://www.domain-name\.com/$1 [R=301,L]

where domain-name is replaced with the actual name of your site. All this is doing is redirecting non-www URLs to www ones.

3) In Google Webmaster Tools, in your domain go to Configuration > Settings and set the preferred domain to be www (see below):

google-webmasters

Then your site will use www and your search engine rankings will stay the same as with non-www. Once done you can use the Google PageSpeed Service.

9 thoughts on “How To Set Up Google PageSpeed Service With WordPress”

  1. This is really awesome. My site loads really slow and this technology certainly helps a lot. I gotta check it out!

    Thanks for sharing this and I have never heard of this Google Speed yet (Even on my fb)

  2. Thanks again for great information. Between you and Andrew there is no need for anyones site not to run smooth. The best thing that ever happened to me as a blogger is getting to know you two guys. You are great and thanks for always keeping me up dated with the best information for a smooth running site.
    Love you guys,
    Debbie

  3. Hi Joel, does this service actually eliminate the need for a caching plugin for example, or do you still have to make changes on your site yourself to take full advantage of this service?

    1. Hi Marita, good question! No, it doesn’t eliminate the need for a caching plugin too, though you can certainly try without it. I use both as the plugin helps with browser caching instructions and a few other things that are outside of what PageSpeed does.

  4. Joel:

    (1) Where in the .htaccess file do you add the code for www configuration?

    (2) How does one determine that the .htaccess folder is in the root folder of your website?

    1. Hi,
      1) I added it to the top so it’s the first rule it comes across.
      2) The root folder is usually called public_html or httpdocs depending on your host. There should be a .htaccess there already and this is for the main domain on your account. If you have addon domains then you will need to change the individual .htaccess in the specific domain folder.

Leave a Reply to marke Cancel reply