Subdomains (2 posts)

  1. Mordkanin
    Posted 2 years ago #

    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 http://test.mysite.com/, I get dumped into http://mysite.com/

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

    if (stristr($_SERVER["HTTP_HOST"], 'test'))
    header( 'Location: http://www.google.com/' ) ;

    and go to http://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.


    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?

  2. Mordkanin
    Posted 2 years ago #

    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....

Topic Closed

This topic has been closed to new replies.

About this Topic