SEO - 301 Cononical Redirect - Removes WWW
Removes WWW from the current URL, if exists.
Copy this code and paste it in your HTML
<?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']); ?>
Report this snippet
Comments
Subscribe to comments