WWW’s Are Deprecated

This isn’t a new idea — http://no-www.org/. In brief, www.somedomain.com would be considered a subdomain, rather than the root. It looks too long (4 more characters) and it looks ugly. Who the hell wants three W’s and a dot sitting in front of their domain name?

The cure

PHP

This will work well if it’s included in every page of your site — use a global header file that’s included on every page.

<?php
if ("mtsix.com" != $_SERVER['HTTP_HOST']) {
header('HTTP/1.0 301 Moved Permanently');
header('Location: http://mtsix.com'.$_SERVER['REQUEST_URI']);
}
?>
.htaccess mod_rewrite

This is probably the more preferable method, although only Apache supports it. Create a file called .htaccess with the following code.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^mtsix.com [NC]
RewriteRule ^(.*)$ http://mtsix.com%{REQUEST_URI} [R=301,L]

These two
great tricks
are taken from Mathias.

post a comment12 Comments

  1. 1May 23rd, 2005Becs says

    Not a clue what you are on about but HI, anyways. I tried that domain thingy.. I don’t get it.. so what is the point?

  2. 2May 24th, 2005Oliver Zheng says

    www’s in front of domains just look dumb :-P wouldn’t vintagefairy.com look much better than www.vintagefairy.com? :)

  3. 3May 25th, 2005Mathias Bynens says

    That’s the spirit — spread the good word!

  4. 4May 25th, 2005Becs says

    yeh.. every website would be.

    bec.domain.com

    lol.. looks much prettier

  5. 5May 25th, 2005satoshi says

    I’ve always hated the www, thing. So when one of the sites I used to frequent, gcdev.com, required the www, I was majorly annoyed. I set up my site, via Dreamhost’s panel thingy, to redirect www.sugardeath.net to sugardeath.net.

    Oh, Mathias, I’m here at school right now and the filtering software (N2H2’s Bess) won’t let me to your site, categorizing it as “pornography.” They used to say gcdev.com was porn as well, though they have since changed it to gaming.

  6. Math Jazz equals Porn
    Say what?

  7. 7May 25th, 2005Oliver Zheng says

    Haha ouch. You must have some word that’s part of the filter system. But now that you have the word porn on your site, it’ll be more classified as one of those pages :P

  8. 8May 28th, 2005Mathias Bynens says

    Aarghh, it’s a friggin’ vicious circle!

    By the way, the fourth line of the PHP code should read header('Location: http://mtsix.com' . $_SERVER['REQUEST_URI']);

  9. 9May 28th, 2005Oliver Zheng says

    Hmm. What was the “n” thing for. Thanks for correcting me :)

  10. 10May 28th, 2005Mathias Bynens says

    I think it originally was a \n

    But still, porn!

  11. 11May 29th, 2005Leo Kent says

    I don’t tend to put the www. in front of domains when I am typing them into the browser as it takes longer. However you may notice that your own site has a lower page rank when it does not have the www. in front of it. For this reason I tend to advertise my own site with the subdomain.

  12. 12May 31st, 2005Mathias Bynens says

    However you may notice that your own site has a lower page rank when it does not have the www. in front of it. For this reason I tend to advertise my own site with the subdomain.

    Leo, that’s not true. The only reason your site has a higher page rank with the www. in front, is because there are more links to http://www.leokent.com/ than to http://leokent.com/. In fact, when you use one of the above redirection scripts, Google shall be notified (in a 301 error type of way) that your site should be accessed via the no-www domain. You’ll even see your page rank increase, as what used to be two different mirrors serving the same content to Google, will now become one. I remember the PR of my no-www domain climbing from PR 4 to 6 the day after applying this script on my site.

Post a Comment

Name and email are required (website is optional). Basic HTML is enabled.

Your email address is not revealed to anyone.