[wp-trac] [WordPress Trac] #51700: Infinite redirect loop error when blog site is rewritten and real domain on another server

WordPress Trac noreply at wordpress.org
Tue Nov 3 14:02:08 UTC 2020


#51700: Infinite redirect loop error when blog site is rewritten and real domain on
another server
--------------------------+-----------------------------
 Reporter:  vladop        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Canonical     |    Version:  5.5.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I have my main site at: http://mainsite.com hosted on server A.
 I have my wordpress blog hosted on some other domain however it is
 rewritten to http://mainsite/blog (although under the hood is is on
 another domain http://myblogonmyserver.com) and it is hosted od server B.
 Both machines are Windows Server machines and PHP is 7.4 altought version
 of php is not an issue here. This bug is there for at least year. I found
 solution and source of bug.

 It is inside canonical.php file (around line 65)

 In latest version of wordpress (5.5.3) it is in fact around line 71 . I
 just added this part of code:

 {{{#!php
 <?php
 $sURL = site_url();
         $asParts = parse_url( $sURL );
 $requested_url .= $asParts['host'] ;
 }}}

 after this if statement:

 {{{#!php
 <?php
 if ( ! $requested_url && isset( $_SERVER['HTTP_HOST'] ) ) {
                 // Build the URL in the address bar.
                 $requested_url  = is_ssl() ? 'https://' : 'http://';
                 $requested_url .= $_SERVER['HTTP_HOST'];
                 $requested_url .= $_SERVER['REQUEST_URI'];
         }

 and now works in my case. Issue is that I have update  this part of code
 every time I update wordpress
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51700>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list