[wp-trac] [WordPress Trac] #36737: Single site reachable on multiple subdomains always redirected to site_url

WordPress Trac noreply at wordpress.org
Tue Jun 28 03:27:58 UTC 2016


#36737: Single site reachable on multiple subdomains always redirected to site_url
--------------------------+------------------------------
 Reporter:  jsoft         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Canonical     |     Version:  4.5
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by denisco):

 Hi jsoft,
 I have the same problem and I disabled the redirect_canonical:
 {{{#!php
 <?php
 function disable_canonical_redirect($redirect_url) {
     if(strpos($_SERVER['HTTP_HOST'], 'subdomain1') !== false
     || strpos($_SERVER['HTTP_HOST'], 'subdomain2') !== false
     || strpos($_SERVER['HTTP_HOST'], 'subdomain3') !== false
     || strpos($_SERVER['HTTP_HOST'], 'subdomain4') !== false
     || strpos($_SERVER['HTTP_HOST'], 'subdomain5') !== false) {
         $redirect_url = false;
     }

         return $redirect_url;
 }

 add_filter( 'redirect_canonical', 'disable_canonical_redirect' );
 ?>
 }}}
 I think this is a bad solution, but I do not know how best to resolve this
 situation.

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


More information about the wp-trac mailing list