Forum Moderators: phranque
// Redirect Bad Domain
$protocol = ($_SERVER['HTTPS']) ? $URL_SSL : $URL;
if
(
$_SERVER['HTTP_HOST'] != $_SERVER['SERVER_NAME']
&& $_SERVER['HTTP_HOST'] != $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']
)
{
GoToPage(rtrim($protocol_host, '/') . $_SERVER['REQUEST_URI']);
}
the question could be completely translated to a non-PHP context
// Redirect Bad Domain
$protocol = ($_SERVER['HTTPS']) ? $URL_SSL : $URL;
if
(
$_SERVER['HTTP_HOST'] != $_SERVER['SERVER_NAME']
&& $_SERVER['HTTP_HOST'] != $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']
)
{
GoToPage(rtrim($protocol_host, '/') . $_SERVER['REQUEST_URI']);
if hostname <> servername
and hostname <> servername:port
then redirect to request_uri
#3 THEN redirect to ... uh ... the page they asked for in the first place, only on their own domain instead of yours