Getting Redirected to the Live Site After Login on Pantheon Hosting

On websites hosted at Pantheon servers, there is a configuration file at the root directory of WordPress called wp-config-pantheon.php.
That’s the file where all your site’s database information is stored, and also these two parameters are configured there:

define('WP_HOME', $scheme . '://' . $_SERVER['HTTP_HOST']);
define('WP_SITEURL', $scheme . '://' . $_SERVER['HTTP_HOST']);

When this file gets cloned to the staging site’s directory, these two lines must be commented, as we already define them in the wp-config.php file with the correct value for the staging site.

So you will need to modify this file at the staging site’s directory wp-config-pantheon.php.
Just add // in front of each line of the above, so they should be like:

//define('WP_HOME', $scheme . '://' . $_SERVER['HTTP_HOST']);
//define('WP_SITEURL', $scheme . '://' . $_SERVER['HTTP_HOST']);

Updated on August 17, 2021