From d2bf6b2a4430e306d18a05611020d02e9129fc15 Mon Sep 17 00:00:00 2001
From: Brian Weaver <weaver.299@osu.edu>
Date: Mon, 20 Apr 2020 13:45:47 -0400
Subject: [PATCH] Move www.*.osu.edu redirect after other site-specific
 redirects

---
 web/sites/default/settings.local.php | 17 -----------------
 web/sites/default/settings.php       | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/web/sites/default/settings.local.php b/web/sites/default/settings.local.php
index 754e66b5fa..8e806593d7 100644
--- a/web/sites/default/settings.local.php
+++ b/web/sites/default/settings.local.php
@@ -16,23 +16,6 @@
   $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
  */
diff --git a/web/sites/default/settings.php b/web/sites/default/settings.php
index aded6f2810..f083a030ee 100644
--- a/web/sites/default/settings.php
+++ b/web/sites/default/settings.php
@@ -61,6 +61,22 @@
   include $redirects_file;
 }
 
+/**
+ * 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();
+}
+
 /**
  * Always install the 'standard' profile to stop the installer from
  * modifying settings.php.
-- 
GitLab