Return to Snippet

Revision: 54236
at December 16, 2011 03:39 by thewickedchemist


Initial Code
<?php
if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') {
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
}
?>

Initial URL

                                

Initial Description
Issues a check to see if the "www" is included, if not, forces "www" to be appended to the URL in question.

Initial Title
SEO - 301 Cononical Redirect - Adds WWW

Initial Tags
redirect

Initial Language
PHP