I just flicked the switch to redirect all content from www.benjamingolub.com to benjamingolub.com (try it out yourself!). The idea is that the www. in the front is not required, it’s just fluff. The argument is a little flawed:
Mail servers do not require you to send emails to recipient@mail.domain.com. Likewise, web servers should allow access to their pages though the main domain unless a particular subdomain is required.
I get their point…but thats why we have MX records for domain.com to point to mail.domain.com. Web hosting doesn’t do this. I’m mainly doing it for cosmetic reasons but I also gain some SEO (search engine optimization) along the way.
How to do it?
I dropped the following in a .htaccess file (it didn’t work directly in my vhosts.conf for some reason, there was an extra / everywhere):
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.benjamingolub\.com [NC]
RewriteRule ^(.*)$ http://benjamingolub.com/$1 [R=301,L]
</IfModule>
And that’s it. Make sure that this bit of code comes before any wordpress redirects or you might have problems. Now all www.benjamingolub.com points to benjamingolub.com. Why would I want to do this?
It’s Prettier
I decided that the title of my site would be benjaminGolub.com and definitely didn’t like it as www.benjaminGolub.com. It’s shorter and, while some people might be confused, they can still type in the www. to reach my site. But what, besides being pretty, other benifits are there?
Only One Link Target
Google (and any other search engine) sees a link from www.benjamingolub.com and benjamingolub.com as going to 2 different sites. So if half of my incoming links go to www.benjamingolub.com and half to benjamingolub.com then I’m effectively halving my potential pagerank; that is not good! By redirecting with the code 301 I am telling Google that it is moved permanently. Google is smart enough to understand that benjamingolub.com is the preferred site and all links to www.benjamingolub.com should count. This will take some time to propogate through the internet. Currently if you come across my site in Google it will link you to www.benjamingolub.com, but the next time they re-index this should be fixed.
No Duplicate Content
Another benefit of telling Google it’s been moved permanently is that this prevents them from seeing duplicate content. Before Google would think that www.benjamingolub.com/some-story and benjamingolub.com/some-story were different pages with the exact same content; this is a big no-no! You’re basically doubling the number of pages while keeping the content exactly the same, which makes my blog look a little bit like a spam site. By issuing a 301 redirect I’m effectively saying “this content has been moved permanently, go here instead” and your browser and Google’s spider are smart enough to follow my redirection.
So, in conclusion, I get a prettier url, consistency, and no duplicate content. Hurray!

Add New Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks
(Trackback URL)