So, if you haven’t noticed, I don’t much care for the www prefix on the worldwide web. As a matter of fact, I hate it. Orson Scott Card’s vision of the nets in his Ender series didn’t have it, and I see it as a way of “dumbing down” the web.
It has gotten so bad that my school, the U of U, can’t actually have a domain without www in front of it (which doesn’t say much for students). For example, instead of a simple http://umail.utah.edu, they have instituted and redirected it to http://www.umail.utah.edu. How IRRITATING? People just can’t grasp the idea that the ever-fabulous Intarnetweb can be used without a www prefix.
So, on EVERY site I work on, I am making it policy to remove the blasted www prefix. It’s easy to do in Apache with a simple .htaccess file. Here’s the code:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^domain.com [NC]
RewriteRule ^(.*)$ http://domain.com%{REQUEST_URI} [R=301,L]
If you want to do something more tricky, say redirecting all inquiries over an SSL connection (like I did on treebroker.com), here is the code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain.com [NC]
RewriteRule ^(.*)$ https://domain.com%{REQUEST_URI} [R=301,L]
<ifmodule !mod_ssl.c>
Redirect permanent / https://domain.com/
</ifmodule>
I know it’s awful anal of me to feel this way, but ask me if care. What? Oh, no I certainly do NOT care.
As I understand it, the www prefix was originally kind of a “marketing” thing to help people understand that the page was part of the “world wide web.” Of course, a little bit of education would have helped people understand that the Intarnetweb is not just about a simple web browser, but so it went.
So, help stamp out the www from the Internet by redirecting your pages with .htaccess or properly configuring Apache to not use the www prefix.
End of Line