<?php
// 301 Redirect - if url contains www then redirect to non-www
$current_path = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

if ( strpos($current_path,'www.') !== false ) {
	$current_path = str_replace('www.','',$current_path);
	header( "HTTP/1.1 301 Moved Permanently" );
	header( "Location: $current_path" );
}
?>