• Hey folks. I’ve been trying to get subdomain redirects working, and I haven’t had any luck.

    I tried the 3 subdomain plugins, and none of them seemed to work. Something, somewhere is 301ing me before any of them kick in.

    I have the wildcard DNS entry in place. If I go to https://test.mysite.com/, I get dumped into https://mysite.com/

    If I make a simple test.php and put this in it

    <?php
    if (stristr($_SERVER[“HTTP_HOST”], ‘test’))
    header( ‘Location: https://www.google.com/&#8217; ) ;
    ?>?

    and go to https://test.mysite.com/test.php, I do in fact get dumped to google. So that’s a start.

    Using the Automatic Subdomains plugin, nothing happens.

    Looking at its code, it’s fairly simple.

    add_action(‘init’,’tjg_as_get_subdomain’);

    And then in tjg_as_get_subdomain, it tries to figure out whether or not it needs to do a redirect.

    The PROBLEM is that I’ve already been 301’d out of test.mysite.com and into mysite.com before tjg_as_get_subdomain ever fires. I put that code snippet from test.php in that function, and I’m getting sent to mysite.com, not google.

    So something is killing my subdomains before any of these plugins can kick in. It can’t be my server, since my test.php worked: clearly the subdomain is coming through to PHP. So it’s got to be something in WP? Right? Any ideas?

Viewing 1 replies (of 1 total)
  • Thread Starter Mordkanin

    (@mordkanin)

    It would appear that redirect_canonical is causing the subdomain to be removed before we get as far as ‘init’.

    Hmm. What to do about it….

Viewing 1 replies (of 1 total)
  • The topic ‘Subdomains’ is closed to new replies.