Media Temple SSL Redirect Loop

Summary

Some users may experience a redirect loop when using SSL on Media Temple hosting when going to the cart.

Cause

The MediaTemple server’s PHP variable ‘HTTP_HOST’ apparently has ‘:443′ attached to the end of it when operating under HTTPS, even though this modification to the string is not visible otherwise (that is, there doesn’t seem to be a redirection taking place). This addition to the URL creates a mismatch between what WordPress thinks the URL for the requested page should be (which is what could very well be entered into the browser’s address bar), and what WordPress interprets as the requested URL (what is entered in the address bar), which it uses the ‘HTTP_HOST’ variable to build.

Solution

The solution is to remove the ‘:443′ port string from the built URL. Add the following immediately below line 49 (last line of the if statement) in wp-includes/canonical.php (WP 2.3+):

$requested_url = str_replace(':443', '', $requested_url);

The if statement should look like this:

if ( !$requested_url ) {
   // build the URL in the address bar
   $requested_url  = ( !empty($_SERVER['HTTPS'] ) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
   $requested_url .= $_SERVER['HTTP_HOST'];
   $requested_url .= $_SERVER['REQUEST_URI'];
   $requested_url = str_replace(':443', '', $requested_url);
}

See Also

Media Temple SSL Redirect Loop
  • 0.00 / 5 5

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar