If Drupal 7 Add the following to the end of your settings.php file (replace www.example.com):
if (isset($_SERVER['PANTHEON_ENVIRONMENT']) && php_sapi_name() != 'cli') {
// Redirect to https://$primary_domain in the Live environment
if ($_ENV['PANTHEON_ENVIRONMENT'] === 'live') {
/** Replace www.example.com with your registered domain name */
$primary_domain = 'www.example.com';
}
else {
// Redirect to HTTPS on every Pantheon environment.
$primary_domain = $_SERVER['HTTP_HOST'];
}
if ($_SERVER['HTTP_HOST'] != $primary_domain
|| !isset($_SERVER['HTTP_X_SSL'])
|| $_SERVER['HTTP_X_SSL'] != 'ON' ) {
# Name transaction "redirect" in New Relic for improved reporting (optional)
if (extension_loaded('newrelic')) {
newrelic_name_transaction("redirect");
}
header('HTTP/1.0 301 Moved Permanently');
header('Location: https://'. $primary_domain . $_SERVER['REQUEST_URI']);
exit();
}
}
If Drupal 8 Add the following to the end of your settings.php file (replace www.example.com):
if (isset($_SERVER['PANTHEON_ENVIRONMENT']) && php_sapi_name() != 'cli') {
// Redirect to https://$primary_domain in the Live environment
if ($_ENV['PANTHEON_ENVIRONMENT'] === 'live') {
/** Replace www.example.com with your registered domain name */
$primary_domain = 'www.example.com';
}
else {
// Redirect to HTTPS on every Pantheon environment.
$primary_domain = $_SERVER['HTTP_HOST'];
}
if ($_SERVER['HTTP_HOST'] != $primary_domain
|| !isset($_SERVER['HTTP_X_SSL'])
|| $_SERVER['HTTP_X_SSL'] != 'ON' ) {
# Name transaction "redirect" in New Relic for improved reporting (optional)
if (extension_loaded('newrelic')) {
newrelic_name_transaction("redirect");
}
header('HTTP/1.0 301 Moved Permanently');
header('Location: https://'. $primary_domain . $_SERVER['REQUEST_URI']);
exit();
}
// Drupal 8 Trusted Host Settings
if (is_array($settings)) {
$settings['trusted_host_patterns'] = array('^'. preg_quote($primary_domain) .'$');
}
}
Here's [a link] [https://pantheon.io/docs/guides/launch/redirects/]1 Redirect for SEO and Security
Contribute
Make sure your DNS is setup & And you see the new domain/ https all in one turned on from Pantheon
https://pantheon.io/docs/domains/#redirect-to-https-and-the-primary-domain
(You need to see this for the Fastly CDN to use HTTPS
