Kaleem Clarkson
1 min readJan 31, 2019

--

Sean Reiser I 100% agree that it should work :) Here is what code I have in my settings.php file.

if (isset($_ENV[‘PANTHEON_ENVIRONMENT’]) && php_sapi_name() != ‘cli’) {// Redirect to https://$primary_domain in the Live environmentif ($_ENV[‘PANTHEON_ENVIRONMENT’] === ‘live’) {/** Replace www.example.com with your registered domain name */$primary_domain = ‘myawesomewebsite.com’;}else {// Redirect to HTTPS on every Pantheon environment.$primary_domain = $_SERVER[‘HTTP_HOST’];}if ($_SERVER[‘HTTP_HOST’] != $primary_domain|| !isset($_SERVER[‘HTTP_USER_AGENT_HTTPS’])|| $_SERVER[‘HTTP_USER_AGENT_HTTPS’] != ‘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 Settingsif (is_array($settings)) {$settings[‘trusted_host_patterns’] = array(‘^’. preg_quote($primary_domain) .’$’);}}

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Kaleem Clarkson
Kaleem Clarkson

Written by Kaleem Clarkson

Co-Founder & COO of @BlendMeInc, Advocate for Location Independent Workplaces, Drupal Front-End Developer, Community Builder. http://blendmeinc.com

No responses yet

Write a response