[fr] Une recette pour faire disparaître magiquement ce satané "www" des noms de domaines que j'héberge...
I personally hate having “www” in front of a domain name. It’s redundant. If we’re visiting a website, we’re on the web anyway. It also brings no end of problems when people start writing for the web and creating links, because they think that what makes something a “website address” is the “www” in front if it, instead of “http://”. That’s how they end up with links like “http://example.com/www.yahoo.com” on their sites. But I digress.
On [one of the sites I manage](http://cafecafe.ch), we have a restricted members-only area. However, our users started reporting that when they used “www” in front of the domain name, they were being asked for the password twice. I tried myself, and I was simply asked for the password *ad aeternam*. Probably a server configuration glitch somewhere.
Anyway, I decided the simplest solution was to redirect all “www” requests to the non-www domain. I know I had that in place for CTTS at some point, but the setting must have got lost at some point. Instead of [sticking rewrite rules in .htaccess as no-www.org suggests](http://no-www.org/faq.php), I modified my vhost configuration slightly so that it looked like this:
CustomLog logs/example-access combined
Redirect permanent / http://example.com/
*Many thanks to those who gave suggestions and nudged me along the way to this solution.*
- Hairy .htaccess Dreamhost WordPress Problem [en] (2006)
- Trying WPMU [en] (2006)
- Redirections in WordPress [en] (2008)
- Paypal Scam Nearly Got Me [en] (2004)
- Week-end chanson française [en] (2006)
- Browser Language Detection and Redirection [en] (2007)
- We Need Structured Portable Social Networks (SPSN) [en] (2007)
- Taking Collaborative Notes at BlogTalk [en] (2004)
- Eat.ch and Hundreds of Placeholder Sites? [en] (2013)
- LIFT08: Kevin Marks (Google Open Social: The Social Cloud) [en] (2008)