diff --git a/web/sites/default/settings.local.php b/web/sites/default/settings.local.php index 8e806593d7193a5241c6195b7f06ef1f164e95a1..754e66b5fa98c504f80f016c1cf9f0e3b7dd7ae7 100644 --- a/web/sites/default/settings.local.php +++ b/web/sites/default/settings.local.php @@ -16,6 +16,23 @@ $variables = array(); } +/** + * Redirect www.*.osu.edu to *.osu.edu + */ +if (!$cli && preg_match('/^www\.(.+)\.osu\.edu$/', $_SERVER["HTTP_HOST"], $matches)) { + $redirect_url = 'https://' . $matches[1] . ".osu.edu" . $_SERVER["REQUEST_URI"]; + + if (extension_loaded('newrelic')) { + newrelic_name_transaction("redirect"); + } + + $response_code = 302; + header("HTTP/1.0 $response_code Moved"); + header("Location: $redirect_url"); + exit(); +} + + /** * Pantheon-specific settings */