Redirects and SEO Best Practice

Use of the proper kind of redirects is a matter of SEO “best practice”. Every site needs to have redirects (e.g. for example, from your non-www version of your site to your www version or vice versa). And if you don’t, you’re leaving money on the table. In addition, sites evolve over time and URLs change. And any time you make changes to your URLs — whether it’s to the domain, subdomain, subdirectories, filenames, or query strings — you need to ensure links pointing to the old URLs are still valued by Google and the other engines, and that their voting power gets transferred to the new URLs. You can get very sophisticated with your redirects for SEO purposes and utilize what are known as “conditional redirects” — a touchy subject and a potentially dangerous area that I’ll delve more below.

First off, ensure you’re using “301 redirects” rather than “302 redirects” or the link juice (PageRank) won’t transfer to the destination URL. You can verify that 301s (not 302s) are in place by using a “server header checker” like this one. Only a 301 tells engines the previous URL has moved permanently and thus forwards the page’s link equity to the new location.

When should you use a 301 redirect? Say you change your domain name, move content from one subdirectory into another, or you are retiring some pages. Or perhaps you are changing your content management system (CMS), which will change all of your URLs. The precious PageRank these pages have earned is valuable and you want to pass it along to the new pages. You also want to prevent a few weeks of 404 errors in search engines when no redirect is in place and users click on your listing. You’ll want to do it even if you are “retiring” certain pages to an archive URL (e.g., the current year’s Holiday Gift Guide once the holiday buying season is over—although I’d make the case that you should maintain such a page at a date-free URL forever and let the link juice accumulate at that URL for use in future years’ editions and NOT redirect at all). If you’re retiring a product, redirect the URL of the discontinued product page to that product’s category page.

Duplicate content is a big issue for SEO, and 301 redirects come in very handy in eliminating (or at least ameliorating) that issue. Search engines will aggregate and filter out from the SERPs content that it detects to be duplicate. Worse yet, your pages will suffer “PageRank dilution,” where the votes (links) are spread across all the duplicate versions instead of all aggregating to the one single, definitive, “canonical” URL. This can happen, for example, when tracking codes are appended to a URL (e.g., “?source=SMXad”). A current example of duplicate copies of pages with tracking code appended URLs getting indexed in Google can be found here — ironically, it’s Google’s own site (yes, it happens to the best of us, even to Google!). Or when essential parameters are not always ordered in a consistent manner (e.g., “?subsection=5&section=2″ versus “?section=2&subsection=5″). Or when multiple domains or subdomains respond to the request with the same content but no redirect (e.g., “myonlinestore.com/jcp/default.aspx” and “www1.myonlinestore.com/jcp/default.asp” and “mystore.com/jcp/default.asp”. In all the above cases, 301 redirects pointing to the canonical URL would collapse the duplicates and aggregate PageRank.

<START GEEK SPEAK>

Usually a single redirect “rule” can be written to match against a large number of URLs. This is referred to as “pattern matching,” and it allows you to use wildcards (such as the asterisk character) and to capture a portion of the requested URL in memory and to utilize it later in the redirect. This is possible whether you are running Apache or Microsoft IIS Server as your web server. Consider some of the above-mentioned examples, and how to handle each of them using Apache’s mod_rewrite module (which comes bundled with Apache):

# Changing domain names
RewriteCond %{HTTP_HOST} tiredoldbrand\.com$ [NC] RewriteRule ^(.*)$ http://www.newbrand.com/$1 [R=301,QSA,L]

# Removing tracking parameter (but tracked URL still registers in the analytics). Assumes no other parameters.
RewriteCond %{QUERY_STRING} ^source=
RewriteRule ^(.*)$ $1 [R=301,L]

</END GEEK SPEAK>

Above I mentioned the “conditional redirect.” And yes, it comes with a warning: it could get you in big trouble with Google. Matt Cutts, the head of Google’s webspam team, advised during his keynote at SMX Advanced that folks not employ conditional redirects due to the risk of a Google penalty or ban. This type of redirect refers to serving a 301 redirect selectively to search engine spiders like Googlebot. Obviously, when you start serving up different content to humans than you do to spiders (and yes, this includes differing redirects), you get into dangerous territory with the search engines. If you’re using conditional redirects, you probably don’t even need them. For example, if you use a tracking parameter in your URLs to differentiate clickthroughs on links leading to the same content, you don’t need to use conditional redirects to collapse the click-tracked duplicates and aggregate PageRank. You can treat bots and humans equally by serving them both up a 301 redirect. The clicktracked URL will still register in your log files, even though it shows up for only an instant.

Intrigued by all this and want to learn more? Then read my full article “Redirects: Good, Bad & Conditional” published last week on Search Engine Land, and also check out my PowerPoint deck from my SMX West presentation on “Unraveling URLs and Demystifying Domains“.

11 Comments

  • David Klein says:

    Hi!
    I am going to wordcamp on Saturday, and during Wordcamp, I am going to be leading online wordgames on different people’s blogs.
    They will be silly, fun, low tech games using wordpress blogs.
    Would you like to host a game on your blog?
    Each game takes 15 minutes, and you would need to be able to post the game, and keep track of comments that 15 minutes while you are at wordcamp.
    Go to http://www.bodyabcs.com/bwp/word-games/ to read more about it.

    Much Love,
    dk

  • We are thinking about creating a page to redirect to our Facebook page, which is not showing up in Google. For example, http://www.oursite/facebook/, which would go to the facebook page, which has a longwinded url. Is this a good idea? What type of redirect would be best?

  • Stephan Spencer says:

    Kevin,
    That’s a fine approach. I presume those 5 pages that are 301’ing to the 1 new page are all quite relevant to that new page, even though the content is different?

  • Stephan Spencer says:

    Maarten,
    When you say “validate your redirects”, do you mean just check that it’s a 301 or a 302? Then a Server Header Checker like http://www.webrankinfo.com/english/tools/server-header.php would be fine. If you want to see the chain of redirects (if there is one), then you can use “lwp-request” (which I blogged about last year at http://www.stephanspencer.com/programming/command-line-hacks-for-power-users) or the “Live HTTP Headers” extension for Firefox. If you meant if there a tool that will evaluate which redirect you should have used and tell you if you used the “right” one, I don’t know of any. That kinda requires some human judgment. Let me know if I misunderstood you.

  • Maarten says:

    Hi, sorry for the late reply. The Live HTTP header check is very useful. It shows what’s really happening when requesting one of the pages.

    Since I’m not that experienced I could use some help with the judgment part of setting up the redirects. Just to see if I have set up everything like it should be. I’ve had some help so everything should be working correctly.

  • Arthur Banks says:

    I have one website that I have had for many years and started it with a subdomain (since I didn’t know much about the web back then). This is when it use to cost hundreds of dollars a year to have a web domain. So I have very good rankings with that sub domain (front page of Google). If I wanted to create a real domain (.com) how would I best go about changing that over without loosing all my rankings? Or is it better to leave good enough alone?

  • These are few basic strategies which will ensure that your SEO campaign has a very strong foundation. You can then use this strong foundation to build a great SEO campaign which gets you visibility, traffic and helps you create an online brand for your start-up.

  • Tom Chubb says:

    I have a section on my website which I have registered a dedicated domain for.
    I think I would prefer the actual website to get the recognition and have the new domain doing an inline redirect to the main website (using a frame).
    Should I use an .htaccess for a 301 instead?
    Thanks

  • I recently migrated several pages within a site, to a new URL. All (except the index page) lost their page rank… realizing that I was redirecting to the new URLs with mod_rewite without the 301 status code, I added a 301 redirect for these old URLs, but it was probably a couple of weeks after the url changes.

    Is this a recoverable situation? Will I get my page ranks back eventually?

    thoughts?

  • Dv says:

    Interesting!

    Does adding google analytics querystring or any querystring to a URL for a 301 redirect hurt SEO?

    For example,

    For tracking purposes does it hurt SEO to have http://www.oldsite.com redirect via a 301 redirect to
    http://www.new.com/?utm_source=oldsite.com&utm_medium=redirect&utm_campaign=campaign1

    or is the following preferred in regards to SEO:

    http://www.oldsite.com (no querysting) redirect via a 301 redirect to http://www.new.com?

    Thanks!

Leave a Reply

Your email address will not be published.