SEO - 301 Cononical Redirect - Adds WWW
Issues a check to see if the "www" is included, if not, forces "www" to be appended to the URL in question.
Copy this code and paste it in your HTML
<?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']); }
?>
Report this snippet
Comments
Subscribe to comments