{"id":132,"date":"2006-12-27T14:47:32","date_gmt":"2006-12-27T18:47:32","guid":{"rendered":"http:\/\/unitstep.net\/blog\/2006\/12\/27\/taking-the-www-out-of-the-web\/"},"modified":"2006-12-27T14:47:32","modified_gmt":"2006-12-27T18:47:32","slug":"taking-the-www-out-of-the-web","status":"publish","type":"post","link":"https:\/\/unitstep.net\/blog\/2006\/12\/27\/taking-the-www-out-of-the-web\/","title":{"rendered":"Taking the www out of the web"},"content":{"rendered":"
Despite the phrase “World-Wide Web” being as dated and pass\u00c3\u00a9<\/i> as claims of Al Gore “inventing the Internet”<\/a>, the term persists today as the most popular and unnecessary subdomain for websites. Should it really be necessary to type “www” before every domain name? Furthermore, does it even have any more relevance?<\/p>\n Since the major use of Internet is for accessing websites, the “www” prefix shouldn’t be needed anymore. It is an archaic holdover from a previous era, one where browser wars meant IE vs. Netscape and where Geocities was the<\/em> place to be. Thankfully, the folks over at no-www<\/a> have been aiming to improve this for some time. Well, it’s not such a big deal, more just a pet peeve of mine. Most sites out there are thankfully configured well enough so that navigating to “domain.com” just redirects you to “www.domain.com” with no damage done. However, some servers are setup so that navigating to “domain.com” doesn’t<\/em> work, and this forces you to type in the “www” subdomain before. This really doesn’t make sense in today’s world.<\/p>\n In my opinion, all websites should be set up with the no-www version as the default. Using the “www” subdomain should redirect you to the no-www version, with no harm done. This is known as Class-B compliance<\/a>, according to the no-www folks, and it’s probably going to be the best way to go for some time, since many people still use the “www”, after having the phrase drilled into their heads during the late 90’s. <\/p>\n If you’ve signed up for hosting from a provider, chances are they’ve already implemented some sort of compliance, but not the optimal type. For example, most hosting providers will automatically redirect the no-www request to the www one. So, under this configuration, someone entering “domain.com” would be redirected to “www.domain.com”. No big deal, but things could be better. After all, the no-www version is shorter and thus requires less typing and less space. Good if you want to save a few cents on your business cards.<\/p>\n Fixing it is a simple effort that takes a minute or so. All you have to do is edit the The Taking it a step further, you could also redirect any<\/em> subdomain to just the root. For example, I also own the domain “peterchng.com”, and wanted to redirect any request to that address, subdomains included, to my main site. Here’s the directives I used.<\/p>\n
\n<\/p>\nSo what’s the big deal?<\/h3>\n
So, how to fix it?<\/h3>\n
.htaccess<\/code> file in the root of your website, if you’re using Apache. Here’s the following directive I’m using.<\/p>\n
\r\n
# BEGIN no-www\r\n<IfModule mod_rewrite.c>\r\nRewriteEngine On\r\nRewriteCond %{HTTP_HOST} ^www\\.unitstep\\.net$ [NC]\r\nRewriteRule ^(.*)$ http:\/\/unitstep.net\/$1 [R=301,L]\r\n<\/IfModule>\r\n# END no-www<\/code>\r\n<\/pre>\n
RewriteRule<\/code> uses a 301 – this is a special HTTP<\/acronym> code used to tell of a permanent redirection. Browsers and search engines crawling your site will interpret this as an instruction that your website has permanently moved to the non-www address. This is most important for search engines, so that they know that the no-www version is not just a duplicate<\/a> or different website than the previous www version. The 301 instruction tells them that the old www version doesn’t exist anymore, and it has been moved to the no-www address. <\/p>\n
\r\n
# BEGIN peterchng.com FORWARD\r\n<IfModule mod_rewrite.c>\r\nRewriteEngine On\r\nRewriteCond %{HTTP_HOST} ^(([a-zA-Z0-9]+)\\.)*peterchng\\.com$ [NC]\r\nRewriteRule ^(.*)$ http:\/\/unitstep.net\/$1 [R=301,L]\r\n<\/IfModule>\r\n# END peterchng.com FORWARD<\/code>\r\n<\/pre>\n