July 9th 2010
RT @alanogden: hard work moving office today. All in and happy now!

July 9th 2010
obviously our previous tweet meant Friday 9th July :) Thanks to those who let us know!

July 7th 2010
Blog: Slackware, The love affair http://3dpixel.net/blog/slackware-the-love-affair/

July 6th 2010
we are moving to new office premises Friday 6th July. Moving up in the world (literally).

You are here: Home » 3DPixelBlog

www. and non-www.

This makes my blood boil. Why can’t server or website admins assume / expect that users use website addresses with and without the preceding www.? i.e. www.bbc.co.uk vs plain old bbc.co.uk.

I’ve come across two sites this morning alone. Pentagonglasstech.com (www works) and thetraffordcentre.co.uk (www works).

All you need to do, plebians, is alter the DNS slightly to modify the A record so it’s not on the www, but on the domain.com record then set up the www record as a CNAME to point back to the domain.com A record. It works the same as ftp.domain.com, mail.domain.com, these are all CNAME records.

If the admin is worried about the SEO aspect of having both www. and non-www. addresses in the index then use a mod_rewrite .htaccess directive to filter to essentially redirect www. to non-www. or vice versa (totally depending on your preference).

#www to non-www

RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]

RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

or

#non-www to www

RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]

RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

Leave a Reply

You must be logged in to post a comment.