Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kurtschlatzer/544c5e76083a8d525b9a25d2d7156074 to your computer and use it in GitHub Desktop.
Save kurtschlatzer/544c5e76083a8d525b9a25d2d7156074 to your computer and use it in GitHub Desktop.
$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