If this feature doesn't work when you type site address without www. then this fix should work for you.
Credits to Dge-06 for the code.

in catalog/include/configure.php

replace
define('HTTP_SERVER', 'http://yourdomain.com');

by

$site_url = $_SERVER['SERVER_NAME'];

switch($site_url) {

case "yourdomain.com":
define('HTTP_SERVER', 'http://yourdomain.com');
break;
case "www.yourdomain.com":
define('HTTP_SERVER', 'http://www.yourdomain.com');
break;
}

NOT a full package.

More...