/ Published in: PHP

This code wil 301 redirect non-www URLs to the www URL
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$domain=$_SERVER['HTTP_HOST']; $redirect_url="http://www.{$domain}{$_SERVER['REQUEST_URI']}"; if($_SERVER['QUERY_STRING']!=''){ $redirect_url.="?{$_SERVER['QUERY_STRING']}"; } }
Comments
