[wp-trac] [WordPress Trac] #33821: redirect_canonical does not consider port in $compare_original

WordPress Trac noreply at wordpress.org
Wed Jun 18 12:18:01 UTC 2025


#33821: redirect_canonical does not consider port in $compare_original
-------------------------------------------------+-------------------------
 Reporter:  willshouse                           |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Canonical                            |     Version:  2.3
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-unit-tests has-      |     Focuses:
  test-info                                      |
-------------------------------------------------+-------------------------

Comment (by wojtekn):

 > What I can interpret is:
 > If we redirect
 > Example.com:8080 => Example.com:18889
 > But then can I get redirected to => example.com:18889
 > Leading into a redirect loop? (because there is host strtolower
 normalization)

 The case normalization is done only for comparison purposes. However,
 there is one case that we should preserve:

 - Example.com:10200 → example.com:8080 (should redirect but without
 changing domain case)

 I added this as
 `test_different_host_casing_with_port_redirect_without_host_change` test,
 and confirmed that the test goes through fine in trunk, but fails with my
 patch applied. Then, I applied the change you proposed and confirmed that
 this test, along with other tests, goes through. Finally, I added another
 test to explicitly test the port redirect for the same host.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/33821#comment:47>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list