find a location for property in a new city

Friday, 30 July 2010

Developers' guide to search engine optimisation

Search engine optimisation (SEO) is quite a dark art because it is kept somewhat secret by the guys who write the search algorithms. In fact you can make a career out of SEO but that's not you is it. You're a developer and you just want to know roughly the SEO concerns that you should consider when developing a site. No? Oh... well you should. Here is your guide

Status codes and SEO

If you are a developer worthy of gracing the work place you will be well accustomed with 500's and 404's but I notice a lot of interviewees can't tell me what a 301 is. Understanding how different status codes affect SEO is an important start.
301 Permanent redirect
The URL you requested is wrong and should never be used again. Here is the new one. A user won’t see it but a search engine will make a note and be sure to move all its current indexing and value for the old page to the new one.
302 Temporary redirect
The URL has moved somewhere else for now. Search engines will not re-index their page to this new one so will continue to send people to the old page. Your site then 302's them to the new place. This is used for when it is not usual behaviour (e.g. submit new post and you get redirected to that post). Also if you want www.mysite.com?lang=enGB to appear like www.mysite.com on Google this is the one for you.
404 Not Found
Not cool because Google will thing you are an unreliable joke of a site.
500 Internal server error
Not cool because Google will thing you are an unreliable joke of a site. A sneaky Pete will issue a 503 instead.
503 Service unavailable
Means your server is down for some reason. May be maintenance. May be a crash. Whatever it is Google feels sorry for you and will return later to see if it's back. So make an HttpModule that chews up 500's and returns a HttpStatusCode of 503.

Duplicate content

Google despises you for this. If you had a page here: http://www.mysite.com/socks that just contains a list of your favourite socks for example, that's fine. If you also had the exact same list located at http://www.mysite.com/list-of-socks search engines would penalise you for duplicate content. Fair enough really because you are deliberately trying to have more pages about socks on your site by copy and pasting the same page.

But there are more subtle variations that if Google finds will tick you off for duplicating content. The following are variations on http://www.mysite.com/socks that do in fact count as duplicate content (unless the content is entirely different of course):
Actionless querystring
E.g. http://www.mysite.com/socks?source=email . Say you were logging the source for analytics and the source had no affect on the content. This URL would be marked as duplicate content to http://www.mysite.com/socks
Mixed casing
E.g. http://www.MySitE.com/sOcks. I know IIS is case insensitive but there are web servers that are not so Google counts the different casing as a different page and therefore duplicate content.
Secure pages
E.g. https://www.mysite.com/socks. The different protocol makes search engines count this URL as a different one from the original.
What to do?
To resolve all of these things you should look into using canonical URLs. Essentially if you put <link href="http://www.mysite.com/socks" rel="canonical" /> in the <head> section search engines will take that as the URL for the page and attribute any value for pages that include that canonical link to that particular URL.

SEO Friendly URLs

I did believe that friendly URLs are not only user friendly but also good for SEO too. Dan Atkinson pointed out that Google do not add weight to a site based on URL. However, another post from Google suggests that site hierarchies are infact used. (If Google aren't looking at URLs for SEO I wonder why they rewrite all their blog posts...)

Regardless of your leaning I would still recommend that clean URLs are considered even if it is only for the benefit of the user. A URL like http://www.mysite.com/articles/price-of-socks-plumets will have more chance of being linked to or being the URL of choice to click from some search engine results than http://www.mysite.com/articles.aspx?a=9031. Of course you will have to do a database look up based on that string rather than the ID so maybe you may prefer to use http://www.mysite.com/articles/9031/price-of-socks-plumets instead.

To make cleaner URLs you should look into URL Rewriting or ASP.NET 4's Routing engine.

SEO Friendly content

Basic stuff really, make sure you have filled the <title> with the title of the page. All your headings are within <h1>'s, <h2>'s and <h3>'s etc. Make sure you have a <meta content="Everything about socks" name="description"/> and a <meta content="socks, clothing, accessories" name="keywords"/> can't hurt either.

In ASP.NET 4 you can set easily using Page.MetaDescription and Page.MetaKeywords

Follow britishdev on Twitter

3 comments:

  1. Regarding your SEO friendly urls... I'm afraid that you are incorrect. Google does not care about the what the url looks like and will not rank differently based on whether:
    A: There are keywords in the url (friendly names, or otherwise); or
    B: The url is dynamic (as opposed to ending with '.htm').

    The only benefit is for the user, and this has been the case for the last couple of years.

    For more information regarding the myth about static vs dynamic urls, read here:
    http://googlewebmastercentral.blogspot.com/2008/09/dynamic-urls-vs-static-urls.html

    ReplyDelete
  2. Thank you for sharing this with me. You are right from the sounds of it so I have adjusted the SEO friendly URLs section yet I still recommend clean URLs. Here's why.

    Although in that post Google say they don't count the URL structure/hierarchy, I find that hard to believe given this post from them http://googleblog.blogspot.com/2009/11/new-site-hierarchies-display-in-search.html.

    Regardless of their conflicting advice, making friendly meaninful rewritten URLs definitely doesn't do any harm if done properly, i.e. no including irrelevant parameters to the URL.

    Anyway, it is definitely better for the user. Remember it's a UNIVERSAL resource locator. Your URL can be in a blog, and email, on paper, spoken to a friend. Meaningful, friendly URLs win hands down.

    ReplyDelete
  3. In addition to mixed casing, be sure to include a trailing slash.

    Google sees www.mysite.com/products/ as a different page to www.mysite.com/products and is likely to penalise you for it.

    As a work-around you can use isapi rewrite to 301 redirect you to the version with the trailing slash.

    Pete

    ReplyDelete