How to redirect certain requests to use https://www.example.com in pantheon?
That's because the $redirect_location doesn't get updated for https://example.com. See updated code below.


$domain = 'www.example.com';
if(isset($_SERVER['PANTHEON_ENVIRONMENT']) && $_SERVER['PANTHEON_ENVIRONMENT'] == 'live') {
  $location = '';

  if(in_array($_SERVER['REQUEST_URI'], array('/node/524'))) {
    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
      $location = 'http://' . $domain . $_SERVER['REQUEST_URI'];
    }
  }
  else {
    if($_SERVER['HTTP_HOST'] != 'www.example.com') {
      $location = 'https://' . $domain . $_SERVER['REQUEST_URI'];
    }
    if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') {
      $location = 'https://' . $domain . $_SERVER['REQUEST_URI'];
    }
  }

  // Redirect
  if ($location) {
    header('HTTP/1.0 301 Moved Permanently');
    header('Location: ' . $location);
    exit;
  }
}