<?php
if(version_compare(PHP_VERSION, '5.2.0', '<'))
{
echo 'PHP 5.2+ is required. Your PHP version is '.PHP_VERSION;
exit(1);
}
// exclude "Duplicate Content" by reloading the page without subdomain "www."
if(substr($_SERVER['HTTP_HOST'], 0, 4) == 'www.')
{
$domain = 'http://'.substr($_SERVER['HTTP_HOST'], 4, strlen($_SERVER['HTTP_HOST']) - 1).'/';
header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$domain);
die('Redirecting to "'.$domain.'" to avoid duplicate content.');
}