Skip to content

Mark Embling

Blog

Standardising My Domain

Whilst browsing the web, I came across an article on URL Canonicalisation by Matt Cutts which talks about the fact you should standardise on one "main" domain name for your site and ensure any others redirects to it using a 301 permanent redirect.

Now this is all pretty common-sense stuff for all the reasons talked about in the article. Despite this however, I realised I'd completely overlooked it on this site (and others) and was therefore not exactly helping myself in regards to search engine rankings. I resolved to sort this out as soon as I got home. However there was one final problem... which domain should be the main one?

My choices:

  • markembling.info
  • www.markembling.info

Looking around a bit more, there seems to be very little consensus on which is best and there are really no concrete reasons for picking one over the other besides aesthetics and personal preference. So I turned to the twittersphere, and asked the following:

What is everyone's preferred domain form? "www.example.com" or just "example.com"...?

Opinions

The result was interesting:

A pretty large majority said that the form without the www was best, and the www version should be the one which has the permanent redirect. Nobody voted in favour of using the www variant, although there was a vote of no particular preference. The 'other' was this from @tombuildsstuff:

depends on the tld

and the clarification:

well if it's a .com - make it www, if it's .co.uk, make it without

I thought this was an interesting perspective, and I can see the logic in this. In this particular case, my domain is a .info so it would probably fall under the same category as a .com, and certainly in the past I have tended to favour the use of www at least when writing the domain down.

Outcome

In the end, I decided to go for using the version without the www. I rather like the cleanness of it, and lets be honest - do we actually need the www? It's also a pattern which Stack Overflow (and friends) follow. If it's good enough for those guys, its good enough for me too!

Since my server is Apache-based, I just popped these three lines into my configuration file and restarted Apache. Every time the site is accessed using www.markembling.info, it should automatically issue a 301 redirect over to the non-www version.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.
RewriteRule ^(.*)$ http://markembling.info$1 [R=permanent,L]

Job done.

Comments

Ollie Read's gravatar

Ollie Read on said:

I remember you asking this question, and it was one I frequently got stuck with at my old job. I would set clients domains up as domain.tld and have www.domain.tld.

Some will argue that the 'www' prefix is standard, but if you were to get specific, once you had a subdomain (regardless of how it's setup), it becomes a subdomain, rather than a domain.

I believe the addition of 'www' was just to help separate connections for the sysadmin, as other protocol specific subdomains are used liked 'mail' and 'ftp'

Paul's gravatar

Paul on said:

A good basis to URL rewrites for SEO was covered at BarCamp Bournemouth 1 and some notes from it can be found at <a href="http://barcamp.org/28-ways-to-%C2%A3%40*$-up-your-website-with-Duplicate-Content-How-to-avoid-Google's-DC-Filtering">http://barcamp.org/28-ways-to-%C2%A3%40*$-up-your-website-with-Duplicate-Content-How-to-avoid-Google's-DC-Filtering</a>

To force www this works as far as I remember:

Options +FollowSymLinks
RewriteEngine On
# force www IN URL
RewriteCond %{HTTP_HOST} ^(example\.com)$ [NC]
RewriteRule .* <a href="http://www.%1%{REQUEST_URI">http://www.%1%{REQUEST_URI</a>} [R=301,L]

Paul's gravatar

Paul on said:

On second thoughts your solution looks nicer (stealing in progress lol)

Add Comment (required)

(required, never published)



(required)

Return to blog