[wp-trac] [WordPress Trac] #36201: Admin Pagination URLs Use Wrong Hostname

WordPress Trac noreply at wordpress.org
Mon Jan 11 17:49:04 UTC 2021


#36201: Admin Pagination URLs Use Wrong Hostname
-------------------------------------------------+-------------------------
 Reporter:  grimmdude                            |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Administration                       |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing dev-         |     Focuses:
  feedback                                       |  administration
-------------------------------------------------+-------------------------

Comment (by joelfbr):

 Thank you for the great advice! this finally helped me in a similar issue.

 Now, I am wondering which file we have to edit to force WP to always
 respond with the correct host.
 see my question on https://stackoverflow.com/questions/65671943/wordpress-
 redirect-to-main-host

 Replying to [comment:17 wellmadedigital]:
 > We had this same issue and stumbled on this:
 >
 > "The site’s wp-config.php file needs to be updated with a
 $_SERVER['HTTP_HOST'] definition pointing at the main site URL
 (example.com in the example we’ve been considering)." Source:
 https://kinsta.com/knowledgebase/reverse-proxy/
 >
 > Adding `$_SERVER['HTTP_HOST'] = 'yoursite.com';` to our ProxyPass
 settings in wp-config resolved it.
 >
 > As an example:
 >
 > Site exists at subdomain.yoursite.com. Proxied to
 www.yoursite.com/subdomain
 >
 > Added to wp-config to make this work and resolve many of the WordPress
 Admin URL issues (pagination, editing users, etc.):
 >
 > {{{#!php
 > <?php
 > # ProxyPass Settings
 > #
 > # DO NOT REMOVE: overriding the following variables is
 > # required to ensure that any request /journal/* is handled
 > $_SERVER['REQUEST_URI'] = '/subdomain' . $_SERVER['REQUEST_URI'];
 > $_SERVER['SCRIPT_NAME'] = '/subdomain' . $_SERVER['SCRIPT_NAME'];
 > $_SERVER['PHP_SELF'] = '/subdomain' . $_SERVER['PHP_SELF'];
 > $_SERVER['HTTP_HOST'] = 'www.yoursite.com';
 > }}}
 >
 > I still agree with the OP that this feels like a core bug, but I wanted
 to throw this out there as an alternative solution that doesn't require
 core revision.

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


More information about the wp-trac mailing list