...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
// REDIRECTS if (isset($_SERVER['PANTHEON_ENVIRONMENT'])) { if ($_SERVER['PANTHEON_ENVIRONMENT'] === 'live') { // Easily Change status code and base url for testing here: $host = 'headrfootr-my.kettering.gotpantheon.comedu'; $http_code = 'HTTP/1.0 303 See Other'; $redirect = FALSE; // Add URLS to skip this AKA 1-1: $skip = array( '/admissions/test', '/news/trill', ); // Set this to a var so we don't mess with doing all this fun stuff below. $uri = $_SERVER['REQUEST_URI']; // Redirect to legacy site based on set patterns, etc. if (!in_array($uri, $skip)) { // Wildcard $oldRedirects. = array( $wildcard = array( 'admissionsacademics', 'newsalumni-donors', 'researchcurrent-students', 'alumni-donorsdownloads', 'current-studentsemergency', 'faculty-staff', 'office-administrationfaculty', 'ferpa', 'emergencyit', 'academicsnews', );'office-administration', // Time to make the magic happen.'offices-administration', 'research', ); $uri_check = explode // One to One from www.kettering.edyu to my.kettering.edy $onetoone = array( '/archives', '/asc', '/Atwood', '/brand', '/businessOffice', '/career-services', '/cetl', '/commencement', '/communityservice', '/currentstudents', '/deans-list', '/dining', '/emergency', '/employee-information', '/events', '/ferpa', '/financialaid', '/financialAid', '/first', '/flintwater', '/get-word-out', '/give', '/greeklife', '/hr', '/keepmekettering', '/library', '/marcomm', '/nbs', '/Oldschool', '/phonathon', '/regbell', '/registrar', '/sharing-memories-professor-bell', '/studentlife', '/trustee-rsvp', '/water', '/wellness-center', ); // String Match Redirects. $string_checks = array( '/about/accreditation-and-assessment', '/sites/default/files/resource-file-download', ); // Time to make the magic happen. $uri_check = explode('/', $_SERVER['REQUEST_URI']); // Check for Wildcard Redirect || 1 to 1 www to my first. if ((isset($uri_check[1]) && in_array($uri_check[1], $wildcard)) || (in_array($uri, $onetoone))) { $redirect = TRUE; } // Redirect to specific legacy pages or paths. elseif (isset($uri_check[1])) { // Change the URI or HOST based of the base uri path. switch ($uri_check[1]) { case 'alumni': $redirect = TRUE; $uri = '/alumni-donors/get-involved'; break; case 'directory': $redirect = TRUE; $uri = '/faculty-staff/directory'; break; case 'giving': $redirect = TRUE; $uri = '/give'; break; case 'aanouncements': $redirect = TRUE; $uri = '/announcements'; break; case 'partnerships': $redirect = TRUE; $uri = '/alumni-donors'; break; case '~': $redirect = TRUE; $host = 'paws.kettering.edu'; break; case 'ug-admitted': $redirect = TRUE; $host = 'accepted.kettering.edu'; break; case 'iamabulldog': $redirect = TRUE; $host = 'accepted.kettering.edu'; break; case 'admissions': // This was the easiest way to handle all the admissions ones. $redirect = TRUE; unset($uri_check[1]); $uri = implode('/', $_SERVER['REQUEST_URI'])$uri_check); $host = 'www.kettering.edu'; // Check for Wildcardbreak; Redirect first. } if (isset($uri_check[1]) && in_array($uri_check[1], $old)) {// Check for string paths. $redirect = TRUE; if (!$redirect) { } foreach ($string_checks // Redirect to specific legacy pages.as $string_check) { elseifif (issetstrpos($uri, $string_check[1])) !== FALSE) { switch ($uri_check[1]) { $redirect = TRUE; } case 'alumni': } $redirect} = TRUE; } } // If true above, $urilets = '/alumni-donors/get-involved'; have some fun redirects happen! if ($redirect) { break;header($http_code); header('Location: https://'. $host . $uri); case 'directory':exit(); } else { // Regular $redirectredirects =to TRUE;current site. $old = array( $uri = '/faculty-staff/directory';m.kettering.edu', 'admissions.kettering.edu', break); if ($_SERVER['PANTHEON_ENVIRONMENT'] === 'live' case 'giving': && $_SERVER['HTTPS'] === 'OFF') { $redirect = TRUE;if (!isset($_SERVER['HTTP_X_SSL']) || (isset($_SERVER['HTTP_X_SSL']) && $uri $_SERVER['HTTP_X_SSL'] != '/giveON';)) { breakheader($header); header('Location: case '/about/accreditation-and-assessment':https://www.kettering.edu' . $_SERVER['REQUEST_URI']); exit(); $redirect = TRUE; } } elseif $uri ($_SERVER['PANTHEON_ENVIRONMENT'] === '/about/accreditation-and-assessment'; break; }live' && in_array($_SERVER['HTTP_HOST'], $old)) { header($header); } } header('Location: https://www.kettering.edu'. $_SERVER['REQUEST_URI']); // If true above, lets have some fun redirects happen! exit(); } ifelseif ($redirect) { header($http_code);$_SERVER['HTTP_HOST'] == 'my.kettering.edu') { $newurl = header('Locationhttps: http://'. $host . $uri)//www.kettering.edu/faculty-staff'. $_SERVER['REQUEST_URI']; exitheader($header); } header("Location: $newurl"); else { // NORMAL PANTHEON BASE URL REDIRECT WILL GO HERE.exit(); } } } |
Full Settings.php Sample
...