Return to Snippet

Revision: 54237
at December 16, 2011 03:41 by thewickedchemist


Initial Code
<?php 
if(!strstr($_SERVER['HTTP_HOST'],'www.')) 
return;
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://'.substr($_SERVER['HTTP_HOST'],4).$_SERVER['REQUEST_URI']);
exit(); 
?>

Initial URL

                                

Initial Description
Removes WWW from the current URL, if exists.

Initial Title
SEO - 301 Cononical Redirect - Removes WWW

Initial Tags
redirect

Initial Language
PHP