Getting rid of the 'www' prefix

7 Comments

[lang_de]Dieser Eintrag ist nur auf Englisch verfügbar.[/lang_de]

You may or may not have heard about the no-www movement. All my sites have always been reachable with and without the www prefix, and I personally never use the www prefix if I can avoid it. I won't get into the details of why it is a bad idea, but consider this: no one calls the web 'WWW' anymore, and this 'abbreviation' is a lot longer than the expansion ('double-you double-you double-you' vs 'world wide web'). If anything, the prefix should be 'web'.

Starting today, I'm having all my domains permanently redirect to the non-www version of the hostname.

Here's a simple mod_rewrite recipe that should work for any domain:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L,NS]

Put it inside a <Location "/"> block in the appropriate VirtualHost block, or inside a .htaccess in the document root of your site (it doesn't seem to work in a VirtualHost block in the server config, any ideas why?).

It's like magic.

fengor

didnt the mutant always do that?

besides, i never understood why sites dont have it by default

2006-07-09 16:49

sankatze

I never type the WWW, anyway, and I'm always slightly annoyed, if sites aren't reachable without it. Didn't know there was a whole organized group though.

2006-07-09 18:29

moeffju

The mutant was always reachable with and without prefix, but it didn't redirect.

(It still doesn't, only moeffju.net and sibling sites do.)

2006-07-10 00:11

Juliana

Hi Matt, long time no see :) How are you??

Well... I never liked the www... it's annoying.

2006-08-27 20:48

Joseph Crawford

We could not get this to work in the apache configuration file but it seems to work just fine in an .htaccess file.

2007-03-31 01:23

Joseph Crawford

The no-www movement...

Starting today I am no longer going to use the www. on my domain name. There are a few reasons I have come to this conclusion. In my opinion my domain is josephcrawford.com the www. is just a sub-domain of my domain. The www. in a domain name was ju...

2007-03-31 03:50

Joseph Crawford

You should remove the image from comments if it is a trackback rather than showing the big ?, maybe show a trackback image or something to visually seperate them.

2007-04-10 01:00