Forked from alexharris/gist:a44f4602de42192a571e053c5c8828cf
Created
March 6, 2018 19:46
-
-
Save kurtschlatzer/544c5e76083a8d525b9a25d2d7156074 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$subdomains = ['atlanta', 'berkeley', 'columbus']; | |
foreach ($subdomains as $subdomain) { | |
if (isset($_ENV['PANTHEON_ENVIRONMENT']) && | |
($_SERVER['HTTP_HOST'] == $subdomain . '.yoursite.com') && | |
// Check if Drupal or WordPress is running via command line | |
(php_sapi_name() != "cli")) { | |
$newurl = 'http://www.yoursite.com/' . $subdomain . '/'. $_SERVER['REQUEST_URI']; | |
header('HTTP/1.0 301 Moved Permanently'); | |
header("Location: $newurl"); | |
exit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment