From 4cb473a3a747017f308b7bf9884ae06248b0cd1b Mon Sep 17 00:00:00 2001 From: Wojtek Naruniec Date: Fri, 13 Jun 2025 15:54:38 +0200 Subject: [PATCH 01/10] Fix redirect comparison to account for port difference --- src/wp-includes/canonical.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/canonical.php b/src/wp-includes/canonical.php index 58723ebc0d8a4..af2324debfd9a 100644 --- a/src/wp-includes/canonical.php +++ b/src/wp-includes/canonical.php @@ -716,16 +716,20 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { $original_host_low = strtolower( $original['host'] ); $redirect_host_low = strtolower( $redirect['host'] ); + $original_port = isset( $original['port'] ) ? strtolower( $original['port'] ) : '80'; + $redirect_port = isset( $redirect['port'] ) ? strtolower( $redirect['port'] ) : '80'; /* * Ignore differences in host capitalization, as this can lead to infinite redirects. * Only redirect no-www <=> yes-www. */ if ( $original_host_low === $redirect_host_low - || ( 'www.' . $original_host_low !== $redirect_host_low - && 'www.' . $redirect_host_low !== $original_host_low ) + || ( 'www.' . $original_host_low !== $redirect_host_low + && 'www.' . $redirect_host_low !== $original_host_low ) ) { - $redirect['host'] = $original['host']; + if ( strtolower( $original_port ) === strtolower( $redirect_port ) ) { + $redirect['host'] = $original['host']; + } } $compare_original = array( $original['host'], $original['path'] ); From d5dccb6597e35581d5125501dfb08014ade28d43 Mon Sep 17 00:00:00 2001 From: Wojtek Naruniec Date: Fri, 13 Jun 2025 15:58:29 +0200 Subject: [PATCH 02/10] Fix indents --- src/wp-includes/canonical.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/canonical.php b/src/wp-includes/canonical.php index af2324debfd9a..38c208b85116c 100644 --- a/src/wp-includes/canonical.php +++ b/src/wp-includes/canonical.php @@ -716,6 +716,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { $original_host_low = strtolower( $original['host'] ); $redirect_host_low = strtolower( $redirect['host'] ); + $original_port = isset( $original['port'] ) ? strtolower( $original['port'] ) : '80'; $redirect_port = isset( $redirect['port'] ) ? strtolower( $redirect['port'] ) : '80'; @@ -724,8 +725,8 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { * Only redirect no-www <=> yes-www. */ if ( $original_host_low === $redirect_host_low - || ( 'www.' . $original_host_low !== $redirect_host_low - && 'www.' . $redirect_host_low !== $original_host_low ) + || ( 'www.' . $original_host_low !== $redirect_host_low + && 'www.' . $redirect_host_low !== $original_host_low ) ) { if ( strtolower( $original_port ) === strtolower( $redirect_port ) ) { $redirect['host'] = $original['host']; From dee6e6ebc41f5bfe7c5a76c011252c7da0d50bef Mon Sep 17 00:00:00 2001 From: Wojtek Naruniec Date: Fri, 13 Jun 2025 16:00:36 +0200 Subject: [PATCH 03/10] Remove unnecessary strtolower call --- src/wp-includes/canonical.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/canonical.php b/src/wp-includes/canonical.php index 38c208b85116c..e3163e8ca218f 100644 --- a/src/wp-includes/canonical.php +++ b/src/wp-includes/canonical.php @@ -728,7 +728,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { || ( 'www.' . $original_host_low !== $redirect_host_low && 'www.' . $redirect_host_low !== $original_host_low ) ) { - if ( strtolower( $original_port ) === strtolower( $redirect_port ) ) { + if ( $original_port === $redirect_port ) { $redirect['host'] = $original['host']; } } From 02e7b52292d86f7813ca8383999c3b18f3ea5b62 Mon Sep 17 00:00:00 2001 From: Wojtek Naruniec Date: Mon, 16 Jun 2025 21:26:26 +0200 Subject: [PATCH 04/10] Fix losing scheme during the redirect --- src/wp-includes/canonical.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wp-includes/canonical.php b/src/wp-includes/canonical.php index e3163e8ca218f..eae24f80e983e 100644 --- a/src/wp-includes/canonical.php +++ b/src/wp-includes/canonical.php @@ -600,6 +600,10 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { // www.example.com vs. example.com $user_home = parse_url( home_url() ); + if ( ! empty( $user_home['scheme'] ) ) { + $redirect['scheme'] = $user_home['scheme']; + } + if ( ! empty( $user_home['host'] ) ) { $redirect['host'] = $user_home['host']; } From 4aee18b9141a22829ecb41785df3adfe8946e600 Mon Sep 17 00:00:00 2001 From: Wojtek Naruniec Date: Tue, 17 Jun 2025 19:33:08 +0200 Subject: [PATCH 05/10] Add test cases for localhost:port redirect to canonical --- tests/phpunit/tests/canonical.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/phpunit/tests/canonical.php b/tests/phpunit/tests/canonical.php index 886b09312910e..01cd97fb29517 100644 --- a/tests/phpunit/tests/canonical.php +++ b/tests/phpunit/tests/canonical.php @@ -545,4 +545,29 @@ public function data_canonical_attachment_page_redirect_with_option_disabled() { ), ); } + public function test_redirect_non_standard_localhost_port_to_canonical_domain() { + update_option( 'home', 'http://example.com' ); + update_option( 'siteurl', 'http://example.com' ); + + // Simulate a request to a non-canonical domain + $_SERVER['HTTP_HOST'] = 'localhost:10020'; + $_SERVER['REQUEST_URI'] = '/'; + + $redirect = redirect_canonical( 'http://localhost:10018/', false ); + + $this->assertSame( 'http://example.com/', $redirect ); + } + + public function test_redirect_non_standard_localhost_port_to_canonical_domain_with_ssl() { + update_option( 'home', 'https://example.com' ); + update_option( 'siteurl', 'https://example.com' ); + + // Simulate a request to a non-canonical domain + $_SERVER['HTTP_HOST'] = 'localhost:10020'; + $_SERVER['REQUEST_URI'] = '/'; + + $redirect = redirect_canonical( 'http://localhost:10018/', false ); + + $this->assertSame( 'https://example.com/', $redirect ); + } } From 43b3088c5e3c7749105e9fe573e871192a7458cf Mon Sep 17 00:00:00 2001 From: Wojtek Naruniec Date: Tue, 17 Jun 2025 19:36:08 +0200 Subject: [PATCH 06/10] Fix lint errors --- tests/phpunit/tests/canonical.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/canonical.php b/tests/phpunit/tests/canonical.php index 01cd97fb29517..2baa4c22128f0 100644 --- a/tests/phpunit/tests/canonical.php +++ b/tests/phpunit/tests/canonical.php @@ -550,7 +550,7 @@ public function test_redirect_non_standard_localhost_port_to_canonical_domain() update_option( 'siteurl', 'http://example.com' ); // Simulate a request to a non-canonical domain - $_SERVER['HTTP_HOST'] = 'localhost:10020'; + $_SERVER['HTTP_HOST'] = 'localhost:10020'; $_SERVER['REQUEST_URI'] = '/'; $redirect = redirect_canonical( 'http://localhost:10018/', false ); @@ -563,7 +563,7 @@ public function test_redirect_non_standard_localhost_port_to_canonical_domain_wi update_option( 'siteurl', 'https://example.com' ); // Simulate a request to a non-canonical domain - $_SERVER['HTTP_HOST'] = 'localhost:10020'; + $_SERVER['HTTP_HOST'] = 'localhost:10020'; $_SERVER['REQUEST_URI'] = '/'; $redirect = redirect_canonical( 'http://localhost:10018/', false ); From c310341fb36ba28a7e16284c1a362fab60ddc190 Mon Sep 17 00:00:00 2001 From: Wojtek Naruniec Date: Wed, 18 Jun 2025 13:45:23 +0200 Subject: [PATCH 07/10] Add test cases to ensure other canonical redirects still work fine --- tests/phpunit/tests/canonical.php | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/phpunit/tests/canonical.php b/tests/phpunit/tests/canonical.php index 2baa4c22128f0..ab66584942585 100644 --- a/tests/phpunit/tests/canonical.php +++ b/tests/phpunit/tests/canonical.php @@ -570,4 +570,43 @@ public function test_redirect_non_standard_localhost_port_to_canonical_domain_wi $this->assertSame( 'https://example.com/', $redirect ); } + + public function test_different_host_casing_do_not_redirect() { + update_option( 'home', 'http://example.com' ); + update_option( 'siteurl', 'http://example.com' ); + + // Simulate a request to a non-canonical domain + $_SERVER['HTTP_HOST'] = 'Example.com'; + $_SERVER['REQUEST_URI'] = '/'; + + $redirect = redirect_canonical( 'http://Example.com/', false ); + + $this->assertNull( $redirect ); + } + + public function test_redirect_www_to_non_www() { + update_option( 'home', 'http://example.com' ); + update_option( 'siteurl', 'http://example.com' ); + + // Simulate a request to a non-canonical domain + $_SERVER['HTTP_HOST'] = 'www.example.com'; + $_SERVER['REQUEST_URI'] = '/'; + + $redirect = redirect_canonical( 'http://www.example.com/', false ); + + $this->assertSame( 'http://example.com/', $redirect ); + } + + public function test_redirect_non_www_to_www() { + update_option( 'home', 'http://www.example.com' ); + update_option( 'siteurl', 'http://www.example.com' ); + + // Simulate a request to a non-canonical domain + $_SERVER['HTTP_HOST'] = 'example.com'; + $_SERVER['REQUEST_URI'] = '/'; + + $redirect = redirect_canonical( 'http://example.com/', false ); + + $this->assertSame( 'http://www.example.com/', $redirect ); + } } From 2612ea61bfc1a716043db24319bbe450d016ee94 Mon Sep 17 00:00:00 2001 From: Wojtek Naruniec Date: Wed, 18 Jun 2025 14:16:53 +0200 Subject: [PATCH 08/10] Fix one more case, improve description --- src/wp-includes/canonical.php | 22 ++++++++++++++-------- tests/phpunit/tests/canonical.php | 26 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/src/wp-includes/canonical.php b/src/wp-includes/canonical.php index eae24f80e983e..00db00c3c8bcd 100644 --- a/src/wp-includes/canonical.php +++ b/src/wp-includes/canonical.php @@ -725,16 +725,22 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { $redirect_port = isset( $redirect['port'] ) ? strtolower( $redirect['port'] ) : '80'; /* - * Ignore differences in host capitalization, as this can lead to infinite redirects. - * Only redirect no-www <=> yes-www. + * Preserve original host casing if the hostnames are identical (ignoring case), + * or differ in a way that is not just a www <=> non-www variation, + * and the port is the same. + * + * This prevents unnecessary redirects and avoids redirect loops due to host casing, + * but still allows canonical redirects between www and non-www variants. */ - if ( $original_host_low === $redirect_host_low - || ( 'www.' . $original_host_low !== $redirect_host_low - && 'www.' . $redirect_host_low !== $original_host_low ) + if ( + $original_host_low === $redirect_host_low + || ( + 'www.' . $original_host_low !== $redirect_host_low + && 'www.' . $redirect_host_low !== $original_host_low + && $original_port === $redirect_port + ) ) { - if ( $original_port === $redirect_port ) { - $redirect['host'] = $original['host']; - } + $redirect['host'] = $original['host']; } $compare_original = array( $original['host'], $original['path'] ); diff --git a/tests/phpunit/tests/canonical.php b/tests/phpunit/tests/canonical.php index ab66584942585..012270a58a6ad 100644 --- a/tests/phpunit/tests/canonical.php +++ b/tests/phpunit/tests/canonical.php @@ -584,6 +584,19 @@ public function test_different_host_casing_do_not_redirect() { $this->assertNull( $redirect ); } + public function test_different_host_casing_with_port_redirect_without_host_change() { + update_option( 'home', 'http://example.com:8080' ); + update_option( 'siteurl', 'http://example.com:8080' ); + + // Simulate a request to a non-canonical domain + $_SERVER['HTTP_HOST'] = 'Example.com:10200'; + $_SERVER['REQUEST_URI'] = '/'; + + $redirect = redirect_canonical( 'http://Example.com:10200/', false ); + + $this->assertSame( 'http://Example.com:8080/', $redirect ); + } + public function test_redirect_www_to_non_www() { update_option( 'home', 'http://example.com' ); update_option( 'siteurl', 'http://example.com' ); @@ -609,4 +622,17 @@ public function test_redirect_non_www_to_www() { $this->assertSame( 'http://www.example.com/', $redirect ); } + + public function test_redirect_port_for_same_host() { + update_option( 'home', 'http://example.com:8080' ); + update_option( 'siteurl', 'http://example.com:8080' ); + + // Simulate a request to a non-canonical domain + $_SERVER['HTTP_HOST'] = 'example.com:10200'; + $_SERVER['REQUEST_URI'] = '/'; + + $redirect = redirect_canonical( 'http://example.com:10200/', false ); + + $this->assertSame( 'http://example.com:8080/', $redirect ); + } } From af1448230e9a8fd8b960517a8deb6d3b15bca475 Mon Sep 17 00:00:00 2001 From: Wojtek Naruniec Date: Wed, 18 Jun 2025 16:29:05 +0200 Subject: [PATCH 09/10] Refactor tests to DRY using a data provider --- tests/phpunit/tests/canonical.php | 175 ++++++++++++++++-------------- 1 file changed, 93 insertions(+), 82 deletions(-) diff --git a/tests/phpunit/tests/canonical.php b/tests/phpunit/tests/canonical.php index 012270a58a6ad..985fa416ab53e 100644 --- a/tests/phpunit/tests/canonical.php +++ b/tests/phpunit/tests/canonical.php @@ -545,94 +545,105 @@ public function data_canonical_attachment_page_redirect_with_option_disabled() { ), ); } - public function test_redirect_non_standard_localhost_port_to_canonical_domain() { - update_option( 'home', 'http://example.com' ); - update_option( 'siteurl', 'http://example.com' ); - // Simulate a request to a non-canonical domain - $_SERVER['HTTP_HOST'] = 'localhost:10020'; - $_SERVER['REQUEST_URI'] = '/'; - - $redirect = redirect_canonical( 'http://localhost:10018/', false ); - - $this->assertSame( 'http://example.com/', $redirect ); - } - - public function test_redirect_non_standard_localhost_port_to_canonical_domain_with_ssl() { - update_option( 'home', 'https://example.com' ); - update_option( 'siteurl', 'https://example.com' ); - - // Simulate a request to a non-canonical domain - $_SERVER['HTTP_HOST'] = 'localhost:10020'; - $_SERVER['REQUEST_URI'] = '/'; - - $redirect = redirect_canonical( 'http://localhost:10018/', false ); - - $this->assertSame( 'https://example.com/', $redirect ); - } - - public function test_different_host_casing_do_not_redirect() { - update_option( 'home', 'http://example.com' ); - update_option( 'siteurl', 'http://example.com' ); - - // Simulate a request to a non-canonical domain - $_SERVER['HTTP_HOST'] = 'Example.com'; - $_SERVER['REQUEST_URI'] = '/'; - - $redirect = redirect_canonical( 'http://Example.com/', false ); - - $this->assertNull( $redirect ); - } - - public function test_different_host_casing_with_port_redirect_without_host_change() { - update_option( 'home', 'http://example.com:8080' ); - update_option( 'siteurl', 'http://example.com:8080' ); - - // Simulate a request to a non-canonical domain - $_SERVER['HTTP_HOST'] = 'Example.com:10200'; - $_SERVER['REQUEST_URI'] = '/'; - - $redirect = redirect_canonical( 'http://Example.com:10200/', false ); - - $this->assertSame( 'http://Example.com:8080/', $redirect ); - } - - public function test_redirect_www_to_non_www() { - update_option( 'home', 'http://example.com' ); - update_option( 'siteurl', 'http://example.com' ); - - // Simulate a request to a non-canonical domain - $_SERVER['HTTP_HOST'] = 'www.example.com'; - $_SERVER['REQUEST_URI'] = '/'; - - $redirect = redirect_canonical( 'http://www.example.com/', false ); - - $this->assertSame( 'http://example.com/', $redirect ); - } - - public function test_redirect_non_www_to_www() { - update_option( 'home', 'http://www.example.com' ); - update_option( 'siteurl', 'http://www.example.com' ); + /** + * Test domain and port redirections. + * + * @ticket 33821 + * @dataProvider data_domain_and_port_redirections + * + * @covers ::redirect_canonical + * + * @param string $home_url The home URL to set. + * @param string $site_url The site URL to set. + * @param string $request_host The HTTP_HOST to simulate. + * @param string $request_url The URL to test redirection for. + * @param string $expected_url The expected redirect URL, or null if no redirect. + * @param string $failure_msg The message to display on test failure. + */ + public function test_domain_and_port_redirections( $home_url, $site_url, $request_host, $request_url, $expected_url, $failure_msg ) { + update_option( 'home', $home_url ); + update_option( 'siteurl', $site_url ); - // Simulate a request to a non-canonical domain - $_SERVER['HTTP_HOST'] = 'example.com'; + // Simulate a request to a non-canonical domain. + $_SERVER['HTTP_HOST'] = $request_host; $_SERVER['REQUEST_URI'] = '/'; - $redirect = redirect_canonical( 'http://example.com/', false ); + $redirect = redirect_canonical( $request_url, false ); - $this->assertSame( 'http://www.example.com/', $redirect ); + $this->assertSame( $expected_url, $redirect, $failure_msg ); } - public function test_redirect_port_for_same_host() { - update_option( 'home', 'http://example.com:8080' ); - update_option( 'siteurl', 'http://example.com:8080' ); - - // Simulate a request to a non-canonical domain - $_SERVER['HTTP_HOST'] = 'example.com:10200'; - $_SERVER['REQUEST_URI'] = '/'; - - $redirect = redirect_canonical( 'http://example.com:10200/', false ); - - $this->assertSame( 'http://example.com:8080/', $redirect ); + /** + * Data provider for test_domain_and_port_redirections(). + * + * @return array[] { + * @type string $home_url The home URL to set. + * @type string $site_url The site URL to set. + * @type string $request_host The HTTP_HOST to simulate. + * @type string $request_url The URL to test redirection for. + * @type string $expected_url The expected redirect URL, or null if no redirect. + * @type string $failure_msg The message to display on test failure. + * } + */ + public function data_domain_and_port_redirections() { + return array( + 'non-standard localhost port to canonical domain' => array( + 'home_url' => 'http://example.com', + 'site_url' => 'http://example.com', + 'request_host' => 'localhost:10020', + 'request_url' => 'http://localhost:10020/', + 'expected_url' => 'http://example.com/', + 'failure_msg' => 'Failed to redirect non-standard localhost port to canonical domain', + ), + 'non-standard localhost port to canonical domain with SSL' => array( + 'home_url' => 'https://example.com', + 'site_url' => 'https://example.com', + 'request_host' => 'localhost:10020', + 'request_url' => 'http://localhost:10020/', + 'expected_url' => 'https://example.com/', + 'failure_msg' => 'Failed to redirect non-standard localhost port to canonical domain with SSL', + ), + 'different host casing do not redirect' => array( + 'home_url' => 'http://example.com', + 'site_url' => 'http://example.com', + 'request_host' => 'Example.com', + 'request_url' => 'http://Example.com/', + 'expected_url' => null, + 'failure_msg' => 'Should not redirect when only host casing differs', + ), + 'different host casing with port redirect without host change' => array( + 'home_url' => 'http://example.com:8080', + 'site_url' => 'http://example.com:8080', + 'request_host' => 'Example.com:10200', + 'request_url' => 'http://Example.com:10200/', + 'expected_url' => 'http://Example.com:8080/', + 'failure_msg' => 'Failed to redirect to correct port while preserving host casing', + ), + 'www to non-www' => array( + 'home_url' => 'http://example.com', + 'site_url' => 'http://example.com', + 'request_host' => 'www.example.com', + 'request_url' => 'http://www.example.com/', + 'expected_url' => 'http://example.com/', + 'failure_msg' => 'Failed to redirect www to non-www domain', + ), + 'non-www to www' => array( + 'home_url' => 'http://www.example.com', + 'site_url' => 'http://www.example.com', + 'request_host' => 'example.com', + 'request_url' => 'http://example.com/', + 'expected_url' => 'http://www.example.com/', + 'failure_msg' => 'Failed to redirect non-www to www domain', + ), + 'port for same host' => array( + 'home_url' => 'http://example.com:8080', + 'site_url' => 'http://example.com:8080', + 'request_host' => 'example.com:10200', + 'request_url' => 'http://example.com:10200/', + 'expected_url' => 'http://example.com:8080/', + 'failure_msg' => 'Failed to redirect to correct port for same host', + ), + ); } } From 63e7337ad5c621c361f06d506b9c3a217183d31d Mon Sep 17 00:00:00 2001 From: Wojtek Naruniec Date: Wed, 18 Jun 2025 16:33:05 +0200 Subject: [PATCH 10/10] Remove unnecessary code --- tests/phpunit/tests/canonical.php | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/tests/phpunit/tests/canonical.php b/tests/phpunit/tests/canonical.php index 985fa416ab53e..140d8fbcf26b5 100644 --- a/tests/phpunit/tests/canonical.php +++ b/tests/phpunit/tests/canonical.php @@ -556,19 +556,14 @@ public function data_canonical_attachment_page_redirect_with_option_disabled() { * * @param string $home_url The home URL to set. * @param string $site_url The site URL to set. - * @param string $request_host The HTTP_HOST to simulate. * @param string $request_url The URL to test redirection for. * @param string $expected_url The expected redirect URL, or null if no redirect. * @param string $failure_msg The message to display on test failure. */ - public function test_domain_and_port_redirections( $home_url, $site_url, $request_host, $request_url, $expected_url, $failure_msg ) { + public function test_domain_and_port_redirections( $home_url, $site_url, $request_url, $expected_url, $failure_msg ) { update_option( 'home', $home_url ); update_option( 'siteurl', $site_url ); - // Simulate a request to a non-canonical domain. - $_SERVER['HTTP_HOST'] = $request_host; - $_SERVER['REQUEST_URI'] = '/'; - $redirect = redirect_canonical( $request_url, false ); $this->assertSame( $expected_url, $redirect, $failure_msg ); @@ -580,7 +575,6 @@ public function test_domain_and_port_redirections( $home_url, $site_url, $reques * @return array[] { * @type string $home_url The home URL to set. * @type string $site_url The site URL to set. - * @type string $request_host The HTTP_HOST to simulate. * @type string $request_url The URL to test redirection for. * @type string $expected_url The expected redirect URL, or null if no redirect. * @type string $failure_msg The message to display on test failure. @@ -591,7 +585,6 @@ public function data_domain_and_port_redirections() { 'non-standard localhost port to canonical domain' => array( 'home_url' => 'http://example.com', 'site_url' => 'http://example.com', - 'request_host' => 'localhost:10020', 'request_url' => 'http://localhost:10020/', 'expected_url' => 'http://example.com/', 'failure_msg' => 'Failed to redirect non-standard localhost port to canonical domain', @@ -599,7 +592,6 @@ public function data_domain_and_port_redirections() { 'non-standard localhost port to canonical domain with SSL' => array( 'home_url' => 'https://example.com', 'site_url' => 'https://example.com', - 'request_host' => 'localhost:10020', 'request_url' => 'http://localhost:10020/', 'expected_url' => 'https://example.com/', 'failure_msg' => 'Failed to redirect non-standard localhost port to canonical domain with SSL', @@ -607,7 +599,6 @@ public function data_domain_and_port_redirections() { 'different host casing do not redirect' => array( 'home_url' => 'http://example.com', 'site_url' => 'http://example.com', - 'request_host' => 'Example.com', 'request_url' => 'http://Example.com/', 'expected_url' => null, 'failure_msg' => 'Should not redirect when only host casing differs', @@ -615,7 +606,6 @@ public function data_domain_and_port_redirections() { 'different host casing with port redirect without host change' => array( 'home_url' => 'http://example.com:8080', 'site_url' => 'http://example.com:8080', - 'request_host' => 'Example.com:10200', 'request_url' => 'http://Example.com:10200/', 'expected_url' => 'http://Example.com:8080/', 'failure_msg' => 'Failed to redirect to correct port while preserving host casing', @@ -623,7 +613,6 @@ public function data_domain_and_port_redirections() { 'www to non-www' => array( 'home_url' => 'http://example.com', 'site_url' => 'http://example.com', - 'request_host' => 'www.example.com', 'request_url' => 'http://www.example.com/', 'expected_url' => 'http://example.com/', 'failure_msg' => 'Failed to redirect www to non-www domain', @@ -631,7 +620,6 @@ public function data_domain_and_port_redirections() { 'non-www to www' => array( 'home_url' => 'http://www.example.com', 'site_url' => 'http://www.example.com', - 'request_host' => 'example.com', 'request_url' => 'http://example.com/', 'expected_url' => 'http://www.example.com/', 'failure_msg' => 'Failed to redirect non-www to www domain', @@ -639,7 +627,6 @@ public function data_domain_and_port_redirections() { 'port for same host' => array( 'home_url' => 'http://example.com:8080', 'site_url' => 'http://example.com:8080', - 'request_host' => 'example.com:10200', 'request_url' => 'http://example.com:10200/', 'expected_url' => 'http://example.com:8080/', 'failure_msg' => 'Failed to redirect to correct port for same host',