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.
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?
www’s in front of domains just look dumb :-P wouldn’t vintagefairy.com look much better than www.vintagefairy.com? :)
That’s the spirit — spread the good word!
yeh.. every website would be.
bec.domain.com
lol.. looks much prettier
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.
Math Jazz equals Porn
Say what?
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
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']);Hmm. What was the “n” thing for. Thanks for correcting me :)
I think it originally was a
\n…But still, porn!
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.
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 tohttp://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.