To push for a faster web, Google has launched several guidelines and tools that allow you to optimize your website to load faster. If you have followed all the steps, like setting up CDN, minifying CSS and javascripts etc, and find that your website still doesnât load as fast as you wanted to, then it is best for you to setup Googleâs PageSpeed Service and let Google optimize and serve your website for you.
How PageSpeed Service work?
The concept behind the PageSpeed service is simple. After you have set it up, Google will grab a copy of your website, optimize it and cache it in their server. When a request is made on your website, the optimized and cached version from Google server are served in place of the copy from your own server.
Requirement
There are a few things that you must fulfil before you can make use of the PageSpeed Service.
1. Your domain name must contain the âwwwâ prefix (for example, http://www.example.com). Bare domain such as âhttp://example.comâ (without the www) are not supported at the moment.
2. You need to be able to change your domainâs CNAME and Host record. If you have registered your domain name with your web host, you will need to contact your web host and get them to change the CNAME record for you.
Setting up PageSpeed Service on your website
1. Go to this page and click the âSign up nowâ button.
2. Once you have received your invitation, go to Google API page and click the âPageSpeed Serviceâ link in the sidebar.
3. Under the âAdd new domainâ section, enter the domain of your website. Make sure you exclude the âhttp://â and include the âwwwâ for your domain name.
Note: If you have not previously verified your website in Google Webmaster, it will prompt you to verify your website before you can proceed.
When you have completed this step, you are done configuring the Google PageSpeed Service for your website. The next step is to change your domainâs CNAME record so Google can serve the cached page for you.
4. Login to your domain registrar and go to the host record section for your domain. For NameCheap, you can access it from the âAll Hosts Recordâ link under the âHost Managementâ section. For GoDaddy, it is under the DNS Manager section. The instructions below is for NameCheap.
You should see a âwwwâ in your Hosts Record. In most cases, it should be pointed to the same IP address as the â@â record.
Here are the things that you need to change:
- Change the IP address to âpagespeed.googlehosted.comâ (without the quote). In some cases, you might have to add a â.â (dot) at the end (âpagespeed.googlehosted.com.â).
- Next, change the Record Type from âAâ to âCNAMEâ
- Save the changes
Thatâs it. Now you just need to wait for the DNS changes to propagate throughout the web (it could be as long as 24 hours). For those who are not using NameCheap, you can check out the instructions here for your Domain Registrar.
5. Last, but not least, you might want to redirect all your visitor from the ânon-wwwâ domain (http://example.com) to the âwwwâ domain (http://www.example.com) so the cached version from PageSpeed Service will be served at all times. For Apache server that supports .htaccess file, you can just add this entry at the very top of your .htaccess file:
RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com RewriteRule (.*) http://www.example.com/$ 1 [R=301,L] |
Remember to change the âexample.comâ to your own domain name.
Page Speed Comparison
After you have properly setup PageSpeed Service on your site, you can now run a page speed test and see the increase in performance. At the Google API Console, simply click the âRun Speed Testâ link and it will bring you to the page where you can run the speed test.
Now you can sit back and enjoy the speed boost.
No comments:
Post a Comment