Boost Your Site Speed in 5 minutes

In this article, I'll unpack the steps I took to achieve a 99/100 on Google's PageSpeed Test with ClickBump 6 and a few quick tweaks to my site's htaccess file

In this article
  1. Introduction
  2. Editing The htaccess file
  3. Enable GZIP Compression

Editing The htaccess file

As a result of these simple, quick tweaks, my “PageSpeed” and “ySlow” scores have all bumped up as well. They were already pretty good, but I’m constantly trying to optimize for speed and every little bit helps. Especially as more and more users connect to the web over mobile.

The biggest impact can be made simply be adding a few lines to your htaccess file. This file is located inside your site’s “root” directory. Here’s how I edit my file via my site’s cpanel application:

  1. First, once you login to cpanel, look under the “Files” panel and click on the “File Manager” icon. A popup screen will appear like so:cpanel1
  2. Once you’ve checked the “Show Hidden Files (dotfiles) checkbox, click “Go”.
  3. You will then be presented with your files listing. It looks like this:htaccess1
  4. From there, you just highlight the .htaccess file and click “Edit” from the top toolbar. Here’s what the contents of that file should look like when you are done:htaccess2

So, as you can see from the screenshot above, to address Google PageSpeed/ySlow nags for “Specify a cache validator“, gZip Compression, Expires headers and eTags, I’ve added the following to the top of my htaccess files on all my demo sites:

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

<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresActive On
ExpiresDefault "access plus 1 year"

Header unset ETag
FileETag None

After applying those settings and updating your htaccess file on your server, you should be all set. However, if, after several hours, the tools are still reporting that your files are not compressed, The next step should help…

Page 2 of 3 1 2 3

14 Responses to “Boost Your Site Speed in 5 minutes”

  1. Justin says:

    Hi Scott,

    I also have the cPanel Accelerated 2 version yet I do not see anything under optimize website. Any idea where I can locate this or make these same adjustments?

    • Who hosts your site? If hostgator or bluehost, you can hit their chat support and they should be able to help you set it up. You need to edit your htaccess file with the suggested settings above.

  2. Martoons says:

    Hi Scott,
    A programmer I know said there is a lot of difference (speed wise etc, even SEO) between shared hosting (like Bluehost etc) and VPS (virtual server I think that is).

    “On VPS, there will be limited numbers of virtual servers on a physical server. Usually less than 50. Each virtual server gets dedicated RAM, Processes cores, network port.”

    According to him “Google knows if you’re on a VPS or shared hosting. And they gives high priority user-friendly sites. Site that take minimum time to load will be more user friendly.”

    Anyway just food for thought. Surely we can get shared hosting just as fast. Good to know what you think. Thanks

    • Hi Martin, great to hear from you again.

      I think that makes sense, although I prefer shared hosting myself, because its basically plug and play. Dedicated hosting setups are usually self serve when it comes to configuration settings. I know that HostGator and Bluehost (to name a few) have their shared hosting accounts set up so that right out of the box, things just work right. However, most of the server/setup support issues I get come from VPN customers.

      This site should be testament to the fact that you can have fast sites on shared server setups. All of my sites are on shared servers and they run really fast, in large part due to the relatively simple speed optimization techniques we are talking about here.

  3. Martoons says:

    Hi Scott,
    Any idea how to do this using Bluehost? I can’t find anything in my cpanel under software/services > Optimize Site.

    There is the MIME thing and it has a huge list of options…

  4. Andreas says:

    hi, just checked my site – which is actually built with weebly pro theme, with google tool, its 91 – and i did testing your site her, and it’s 91, too – not 99. what changed since your own test?

  5. Roshan says:

    Hi Scott,

    Thanks for reply. I updated as mentioned above. Then it started receiving server error as you mentioned above. Now restored backup.

    Steps Followed.
    01. Diable all the plugins
    02. edited .htaccess file as per above code (line 1 is option index)
    03. uploaded .htaccess file via ftp to public html folder
    04. tested the site
    05. received server error

    any advice

    ~ SB

  6. Roshab, it does not matter on line spacing. Just make sure to create a backup copy of the htaccess file beforehand.

  7. Roshan says:

    Hi Scott,

    There is also a plugin available to use

  8. Roshan says:

    Hi Scott,

    Do I have to add above code as 3 different blocks (giving single space for each code block) in my .htaccess file

    Kindly advice

  9. Warren says:

    Thanks for the link, Scott.

    I’ve got my site up to 96. Mobile version to 93!



  10. Update (6/23/2012)
    Another tip to shave off several microseconds of loading time is to optimize images. To do that, i use Yahoo’s optimizer. Its a free online tool and you can paste the URLs to several images at one and let it run. Once its done, you can download the optimized images and upload them to your site (overwriting the old ones).

☝ Back to Top