Skip to content

Instantly share code, notes, and snippets.

@jasonlancaster
Created June 27, 2019 20:34
Show Gist options
  • Save jasonlancaster/308c22da4e0129fb5749a86623c2824f to your computer and use it in GitHub Desktop.
Save jasonlancaster/308c22da4e0129fb5749a86623c2824f to your computer and use it in GitHub Desktop.
Redirect all prod Drupal access to dev or alt environment
// Redirect user/admin pages to dev site while we are in active dev
/*
if ((
$_ENV['PANTHEON_ENVIRONMENT'] === 'live' ||
$_ENV['PANTHEON_ENVIRONMENT'] === 'test'
) && (
(strpos($_SERVER['REQUEST_URI'], '/user') !== false) ||
(strpos($_SERVER['REQUEST_URI'], '/admin') !== false)
)) {
echo 'https://'. $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header('HTTP/1.0 301 Moved Permanently');
header('Location: https://dev-cua.pantheonsite.io/');
if (extension_loaded('newrelic')) {
newrelic_name_transaction("redirect");
}
exit();
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment