No WWW – Better SEO!

with No Comments

For some time now I have been just dropping the WWW in websites, like www.NewLiphe.org.   I just type in NewLiphe.org and see what happens, 99% of the time I arrive safely or an redirected to the www version.

However, this www. takes up time, and space, and has no real computer or network use.  It is a waste of time.  It slows things down and it wastes full hard-drives of space!

Instead of redirecting:

NewLiphe.org to www.NewLiphe.org

I propose that we should redirect:

www.NewLiphe.org to NewLiphe.org

This would likely result in trillions of bytes all over the world being freed up.  For example, in bookmarks!  Likewise, in the transmission paths.  Everywhere you look there are extra and unneeded www’s!

I have been thinking about how to do this – 301 redirect the www version of any website to the non www version.

.htaccess

Now those who follow me, know I do not like to put a bunch of stuff in .htaccess.  In fact, I think .htaccess works better if it is almost empty.  But this is one of those rare occasions in which .htaccess is likely the best place to handle this.

Cut and Paste

Well I went to the Internet to look for such a code.  Immediately I found hard coded versions.  Meaning you would have to copy it, modify it for your site, and then add it to your .htaccess.  That modification process is hard for people.  There are also people like me who have one .htaccess for a lot of different domains and sub-domains.  Meaning I would have to add hundreds of lines to my .htaccess, not at all acceptable.  I needed a short code people could just simply cut and paste.  Quick and easy…

I did find one that went from no www to www automatically, but that was opposite what I wanted to do.  So I cracked the Apache books once again and looked for my own solution.

PHP

Before I did that, I looked at a php solution…  This may be all that is needed for some people.  If you site always goes through one page, for example a WordPress site, you could just find the php for the index.php and add this to the top…

<?php
  if (substr($_SERVER['HTTP_HOST'], 0, 4) === 'www.') {
    header('Location: http'.(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on' ? 's':'').'://' . substr($_SERVER['HTTP_HOST'], 4).$_SERVER['REQUEST_URI']);
    exit;
  }
?>

Because everything goes through index.php, then all www.’s will be 301 redirected to non-www.’s.

The .htaccess Code

If you can add code to your .htaccess file, this is perhaps the cleanest way to forward www. to non-www.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

This is a short code you copy and paste into any .htaccess on any domain. It evaluates you domain name in the RewriteCond line, keeping everything except the “www.” Then in the RewriteRule, it sends you off to the new address, complete with all directories, files, etc. However, without the www.

Windows Server

I can already hear some of you asking. Ok, that works for Unix, but how do you do this in a Windows Server?  So here is the best piece of advice anyone will give you on this subject…  IF you are serious about your website…  IF you are really trying to get out your message… IF you are trying to make money online… IF you want the BEST SEO Possible… Then switch to a different, non-windows, server.  I would HIGHLY RECOMMEND that you switch to a server based on Ubuntu or FreeBSD and uses Apache.  You will be very glad you did and you SEO will jump also.

Better SEO

Were you aware of the Internet change that gives better SEO to websites that do NOT use the www?  It saves the search engines trillions of bytes of storage and transmission costs (remember that Google dropped the </html> at the end of returned pages to save those few bytes, multiplied by billions of pages a day, that is a lot of savings.  So is losing the www.

Leave a Reply