May 18th 2012
RT @alanogden: going to introduce @madnexus to proper fish and chips for #fridaylunch @3dpixelnet @snetty

May 14th 2012
all servers are now upgraded to 1Gbit connections.

May 9th 2012
So your website has been hacked? #salvagemysite http://t.co/mOjhgegC

April 25th 2012
the cobalt platform is back up and running now.

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.