<?PHP
#
#   FILE: Redirect.php
#
#   Part of the Collection Workflow Integration System (CWIS)
#   Copyright 2015 Edward Almasy and Internet Scout
#   http://scout.wisc.edu/cwis
#

global $H_CleanUrl;

$GLOBALS["AF"]->SuppressHTMLOutput();

header($_SERVER["SERVER_PROTOCOL"]." 301 Moved Permanently");

# if relative url given, convert to absolute URL to comply with RFC2616
# (yes, RFC7231 relaxes this constraint, but we'd rather be
#   conservative about what we expect browsers to understand)
if (!preg_match('%^https?://%', $H_CleanUrl))
{
    $H_CleanUrl = OurBasePath().$H_CleanUrl;
}

header("Location: ".$H_CleanUrl);
