Being a web geek I tend to have my fingers in all the bits and bytes that circle the world wide web, Now this is not in anyways bad but it means my time is always pulled into diverse little specs of dust, fluttering from one space into the next!
Now recently I’ve been asked alot about Search Engine Optimization, and how people can improve their own domain listings within Google, Bing, Yahoo and other Search engines without going into the whole symantic drama that is HTML coding.
Being a web developer I thought to myself there is no way to fix a ranking without editing the site! Or is there?… Apprently around 30% of company websites and other small organisations don’t realise that they are infact doing this and they kill off alot of their own rankings due to one little issue that is the www’s!
Still not with me? I’ll run you upto speed on what I’m referring to…
Believe it or not, you can actually ask Google, “How many pages of my website do you have in your memory?”… To do this you need to use the site:url syntax within a Google search, What Google will then do is reply with a list of all your domains pages. Fortunatly if you havn’t been savi and not added this very little fix you will see that Google will have dropped alot of originally decent content and placed it upon the other domain.
Google Search Comparisons
Without www’s

With www’s

Now the above is pretty obvious, I’ve requested all the pages that are in the google listing engine that are registered under the said sites. Obviously these two domains are the same… So why is google indexing them seperately? Thats down to how you have your server/site setup.
Ideally what you want is one domain that is either http://test.com or http://www.test.com and not both.
To fix the issue and gain your search engine rankings quickly you need to tell a visitor to go to either one or the other. Now the question I know you’re going to be asking is, “Which is better, www’s or no www’s?”. Now this is down to personal perference but I personally rather have no www’s, and i’ll explain why.
With the internet progressing with Twitter, Facebook, and other various mobile devices people are using urls more and more day in and day out. Now when you type addresses all day like I do you tent to get bored and annoyed at typing www’s time after time!
Also I actually prefer to go for with the other big reason, I love to use short URLs and www’s are annoying (In my opinion).
The mod_rewrite redirect fix
To impliment this into your site couldn’t be easier! Just FTP onto your webhosting and into the root directory of your hosting files, Usuallly that would be www/ or public_html/ (something like that) create a new file called .htaccess and open it up with your editor.
Paste in the following code.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} ^www.dancunningham.co.uk [NC]
RewriteRule ^(.*)$ http://dancunningham.co.uk/$1 [L,R=301]
Now if you have multiple Top Level Domains (TLD’s) then you might want to point them all to the same hosting server / directory. Again thats not a problem we can tell the site to handle these in a similar way. Just add the extra domains into your .htaccess like the below example and the apache server will handle the rest.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} ^www.dancunningham.co.uk [NC]
RewriteRule ^(.*)$ http://dancunningham.co.uk/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www.cunni.co.uk [NC]
RewriteRule ^(.*)$ http://dancunningham.co.uk/$1 [L,R=301]
I hope that this tutorial makes sense and helps those who are suffering fundamental search engine ranking issues! I only know of these issues as I’ve experienced them for myself. So again im simply passing on some knowledge to help others learn from mine. If anyone has anything they wish to add or comment on then please do so below.






Andy says:
Some very sound advice here. I regret not doing this when I first set up my server.
Aug 25, 2010, 1:26 pmDan Cunningham says:
Thanks Andy!
Alot of people totally forget about things like this, It might be that search engines do figure out that they are indeed the same domain, but why my the engines job any harder?
They need to find your content quick and having it in multiple domain locations just doesn’t help once bit.
I hope others find this usefull too.
Sep 25, 2010, 1:29 amminecraft says:
Informative post. Thank you for share.
Sep 15, 2011, 4:01 pm