I have a script running on my site which is meant to redirect users who browser to '/' and then send them to 'www.' using a 302 redirect.
What I am confused about in Chrome is why it works but ends up sending them to...
I downloaded the script and don't really understand it.... Basically I want the script to take anybody who is going to /site.com and redirect them using 302 to www.site.com
This is the script..
<?php
$protocol = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
if (substr($_SERVER['HTTP_HOST'], 0, 4) !== 'www.') {
header('Location: '.$protocol.'www.'.$_SERVER['HTTP_HOST'].'/'.$_SERVER['REQUEST_URI']);
exit;
}
include_once("index/index.html");
?>
Any ideas?