10 replies
  • SEO
  • |
In my opinion, page speed is one of the most difficult things to get right. If you have ever used a page speed analyzer and tried to follow its recommendations, you are probably already aware that some tasks offer marginal improvements in exchange for a lot of headache. I wanted to offer some insights from my own experiences in the hope that someone else who is frustrated will find this useful.

Leveraging Browser Caching

There are a lot of different ways to get this done and I'll cover how to do it with .htaccess here. You can significantly speed up your website by setting an expiry date for resources that don't change that often and even for ones that do.


It is generally recommended that you do not use the catch-all ExpiresDefault as that will set one expiry date for all of your cachable resources. You may not want this to happen because if you make changes to certain things on a regular basis, users would have to wait until the resource expired in their browsers before the updates would take effect.


By using Page Speed Insights from Google, you can get a good idea of the resources that are candidates for long expiry dates. In general, things like Javascript, CSS, and images that aren't changed out a lot are good candidates for long expiry dates (i.e. 6 months to a year).


Don't set your expiry dates for more than a year as that may cause issues with your site.


Here is a sample of code for setting the expiry date for image, js, html and css files for one month in the future.

Code:
#enable expirations
  ExpiresActive On
  # expire GIF images after a month in the client's cache
  ExpiresByType image/gif A2592000
  # expire PNG images after a month in the client's cache
  ExpiresByType image/png A2592000
  # expire JPG after a month in the client's cache
  ExpiresByType text/jpg A2592000
  # expire CSS images after a month in the client's cache
  ExpiresByType text/css A2592000
  # expire HTML after a month in the client's cache
  ExpiresByType text/html A2592000
  # expire JS after a month in the client's cache
  ExpiresByType text/javascript A2592000

Notice that the time frame is entered in seconds. The "A" at the beginning of that string tells the server to start that timer at the users last access date. If you were to use M, it would start the timer at the date last modified. You can use either one depending on your purposes. For example if you change things frequently you may want to use M.

If the above code does not work for you, try <filesMatch> like this,

Code:
<filesMatch "\.(js)$">
      ExpiresDefault A29030400
  </filesMatch>
  <filesMatch "\.(jpg)$">
      ExpiresDefault A29030400
  </filesMatch>

Enabling G-zip Compression

Compressing files on your server before they are sent to the client's browser to be unpacked is a great way to speed up a site. The method you use however can vary depending on features available from your host and your hosting environment. If you are using Apache and your host has mod-gzip and/or mod_deflate enabled, you can use the snippets below. Note if you are using Apache 1.3 you will need mod_gzip. 2.0 you will use mod_deflate.

Code:
#Gzip
  <ifmodule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
  </ifmodule>
  #End Gzip

And mod_deflate

*Note that these directives turn compression on and off depdending on the browser as not all browsers support compression,


Code:
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
  SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|iso|tar|bz2|sit|rar|png|jpg|gif|jpeg|flv|swf)$ no-gzip dont-vary
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.[0678] no-gzip
   
  # MSIE masquerades as Netscape, but it is fine
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
   
  # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48, the above regex won't work. You can use the following
  # workaround (comment the above line and uncomment the below line) to get the desired effect:
  # BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
   
   
  # Make sure proxies don't deliver the wrong content
  Header append Vary User-Agent env=!dont-vary
   
  </IfModule>

CSS Sprites

CSS sprites can also help you speed up your website. Sprites combine images into as few files as possible. Note that not all images are good candidates for sprites. Typically images that are often loaded together on multiple pages are ideal for this process.

Traditionally, you would need to use a program like Photoshop or Gimp to make a sprite image however there is a really useful tool that combines the images and CSS all in two file for you for free!

It's called SpritePad and you can find it here http://wearekiss.com/spritepad

You just drag and drop your images onto the screen, position them and CSS code is automatically generated to the right. You then just download the files, upload them to your server and you are ready to go.

Serve Resources From a Consistent URL

All the files on your site that are external and needed to render pages must be requested by the browser. Files like CSS and JS are the biggest culprits of multiple http requests. Sometimes common libraries (i.e, JQuery and other JS files) may come pre-installed with plugins or other downloads. If you have plugins that run on JQuery, make sure you are using a local file instead of a Google other CDN.

If you have CSS that can be combined into other CSS files, it is better to combine them to reduce the amount of requests the browser sends to the server. Also, make sure you put CSS requests before external JavaScript requests. Avoid using @import in CSS files.

What tactics do you use to increase site speed?
#increase #site #site speed #speed
  • Profile picture of the author paulgl
    I use logic, and I actually read what google publishes.

    This 2013. Nobody should have a site speed problem.

    Site speed is sooooooooooooooooo low on google's
    ladder, it just isn't worth worrying about.

    And if you are worrying, man, your site has major problems.

    If people really cared about site speed, they'd can wordpress
    in a heartbeat and code themselves. Or get a real CMS.

    Or better yet. Get a real server.

    Paul
    Signature

    If you were disappointed in your results today, lower your standards tomorrow.

    {{ DiscussionBoard.errors[7902826].message }}
    • Profile picture of the author Adam2
      Great post. Page speed is more important than many people realize for rankings. There's a reason Google provides comprehensive resources for webmasters
      https://developers.google.com/speed/
      https://developers.google.com/speed/pagespeed/insights

      Even improving your site by a few milliseconds can be the difference between someone closing the page or sticking around to see what your site has to offer (which also influences seo rank).

      Simply installing w3t cache on wordpress and utilizing Cloudflare's free CDN will put you ahead of the majority of webmasters out there.

      Here's a good guide for configuring the w3t plugin Ultimate Guide to W3 Total Cache
      {{ DiscussionBoard.errors[7902954].message }}
    • Originally Posted by paulgl View Post

      it just isn't worth worrying about.
      Thanks for commenting Paul,

      There have been a lot of studies done on this and the speed of a site has actually been shown to dramatically affect conversion rates. It goes hand in hand with the instant gratification people have come to expect online. Think of the last time you sat at a traffic light when it turned green and a motorist in front of you took longer than 5 seconds to start moving. It can seem like an eternity. The only difference is that you have little other choice but to wait. For most websites, people don't always have to wait and they can just as easily hit the back button and try another search result.

      Check out this study data from a couple of different organizations on the affects site speed has on conversions,

      Google's Push To Speed Up Your Web Site

      best,

      Shawn
      Signature
      Outsource to the experts...

      We customize your Blog, eBook, Press Release and Sale Copy content with your message.

      {{ DiscussionBoard.errors[7903240].message }}
      • Profile picture of the author Rehmat
        Originally Posted by TheContentAuthority View Post

        Thanks for commenting Paul,
        For most websites, people don't always have to wait and they can just as easily hit the back button and try another search result.
        Yes it is correct but in present, Internet has much developed and the connection speeds are high enough everywhere so website load speed hasn't left a big issue anymore. Secondly, the web hosts have also developed. You can face the low site speed only, if
        -you are hosting your site with a crappy host
        -you have loaded a lot of (unnecessary) images, codes and other media to your site
        -Using a crap theme / template

        Otherwise this shouldn't be an issue.
        {{ DiscussionBoard.errors[7903826].message }}
        • Profile picture of the author kpmedia
          Originally Posted by Rehmat View Post

          . You can face the low site speed only, if
          -you are hosting your site with a crappy host
          A lot of people at this site (for whatever crazy reason) suggest EIG brands: Hostgator, Bluehost, Justhost, iPage, etc. But those are among the slowest hosts. If you want better speeds, quit using the fake "top 10" hosts. Use better ones.

          That'll give a huge boost to speed, and it does matter to Google.
          {{ DiscussionBoard.errors[7903898].message }}
          • Profile picture of the author Rehmat
            Originally Posted by kpmedia View Post

            A lot of people at this site (for whatever crazy reason) suggest EIG brands: Hostgator, Bluehost, Justhost, iPage, etc. But those are among the slowest hosts. If you want better speeds, quit using the fake "top 10" hosts. Use better ones.
            Hostgator, iPage and BlueHost are popular due to the fact that they are doing well... Yes they might be slow when you will compare shared plans on these hosts with VPS and Dedicated plans on others... Now a days, most people get a fast Internet connection and setup a server in their bed room and then introduce it as a brand but they can't provide the durability. So how they can compete the big brands like BlueHost and Hostgator?
            {{ DiscussionBoard.errors[7904989].message }}
  • Profile picture of the author apnavarun
    I would say rather on side speed focus on backlinks and relativity of page.
    I used site speed test and improved my site speed as google suggested but didn't help much
    {{ DiscussionBoard.errors[7903395].message }}
  • Profile picture of the author challanger
    I found misunderstanding from people who are not in favor of spending time on site sped.

    It looks from their comments they think site speed helps in getting traffic.
    but in actual. it helps to reduce Bounce rate
    when bounce rate goes down, users stay increases and which keeps you up in ranking....


    all these are internally linked to each other..
    {{ DiscussionBoard.errors[7903675].message }}
  • Profile picture of the author truvahorse
    Good article but i'm thinking most important is fast hosting.
    {{ DiscussionBoard.errors[7904731].message }}
  • Some very good points here. Yes the type of host as well as the service you buy from a host (shared or dedicated server) will dramatically impact speed. Yes there are high speed connections but speed can still be an issue even though there is enough bandwidth to accommodate modern websites. Also, not all people have access to these resources.

    As of april 2012, only 66% of Americans have access to broadband internet Pew Internet: Broadband | Pew Research Center's Internet & American Life Project

    Yes there are also much more important factors to SEO than site speed however ignoring something just because it doesn’t seem important is never a good approach. Instead, you should optimize based on a ratio of impact vs time. If something doesn’t take that much time to implement, it should be done even if the impact is marginal. By contrast, if it takes a lot of time, obviously its better to focus efforts elsewhere. Many small tasks that have small impacts can add up to a lot. We wouldn’t only build backlinks to a site, or only do on-site optimization or only focus on content; it’s the totality of all these things that makes a site successful in search.

    Shawn
    Signature
    Outsource to the experts...

    We customize your Blog, eBook, Press Release and Sale Copy content with your message.

    {{ DiscussionBoard.errors[7905075].message }}

Trending Topics