[wp-trac] [WordPress Trac] #26625: Issue with non standard port in redirect_canonical()

WordPress Trac noreply at wordpress.org
Sat Dec 14 17:06:35 UTC 2013


#26625: Issue with non standard port in redirect_canonical()
--------------------------+-----------------------------
 Reporter:  thg2k         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Canonical     |    Version:  3.7.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 I just loaded in my local environment a production wordpress installation
 (files and db) and saw a weird redirection happening when I tried to load
 it.
 The issue has to do with option home_url and redirect_canonical(), in
 particular i tracked down the following offending lines:

 {{{

         // Ignore differences in host capitalization, as this can lead to
 infinite redirects
         // Only redirect no-www <=> yes-www
         if ( strtolower($original['host']) ==
 strtolower($redirect['host']) ||
                 ( strtolower($original['host']) != 'www.' .
 strtolower($redirect['host']) &&
       'www.' . strtolower($original['host']) !=
 strtolower($redirect['host']) ) )
                 $redirect['host'] = $original['host'];

 }}}


 The problem seems to happen if home_url is set to for example
 "http://hello.com" and you access your site using an alias like
 "http://blablabla.com". The redirect keeps the alias host (not sure why?)
 BUT discards the port, so for example if the alias host is instead
 "http://blablabla.com:81" you get redirected to "http://blablabla.com",
 which is inconsistent and totally wrong.

 I would expect one of two behaviours:
 1) You get redirected to http://hello.com/
 2) You get redirected to http://blablabla.com:81/

 Either way would be fine to me, because it would be consistent. If someone
 would be so kind to explain me also why you don't want to redirect based
 on host capitalization I would really appreciate and maybe I can formulate
 a good patch for this issue.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/26625>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list