Mapped Sub Domain Redirects to main site

My has a blog

I followed instructions and mapped the sub site to

But redirects to, not even the old

I've got DNS down to and artform, that's not the problem. I've set up many WPMU networks, but this is my first one with buddypress and WPMUDEV domain mapping plugin.

Where should I start looking?

  • Jason
    • The Incredible Code Injector

    I can also login to the subsite, but still not view it's root homepage.

    I just updated to WP 3.3 to see if it helps, and updated all my subsites. So far, it's behaving the same.

    I checked my nginx config, and it's the same as another one of my multisites that IS working <-- Go to this URL to see what I mean, all links work except the home page button.

  • Jason
    • The Incredible Code Injector

    Not sure what you mean, but I'll reiterate that I've done this before, and the pages of the sub-site work, just not the main page of the sub-site.

    Ergo~ Everything is good. -> magical 301 redirect to ->

    BUT works fine works fine. (Or any page or post or tag for that matter)

    It's ONLY the root,home,whatever page of the subsite.

    It's all done in DNS with a records pointing to a static ip on my virtualhost.

  • Jason
    • The Incredible Code Injector

    serious, three days, I'm going back through nginx configs yet AGAIN...

    It's a 301 redirect, does anyone know how many redirects there are in wordpress?

    I've ran WPMU for over a year now, but I'm new to buddypress.

    Could buddypress be the problem? Could it be the custom domain mapping plugin?

    I can't fathom why only the homepage of the subsite would take me back to the main site.

    Also, the cookies don't seem to be synced. When you use a custom domain do you have to re-login on every different domain?

  • aecnu
    • WP Unicorn

    Greetings Jason :slight_smile:

    congrads on the "It's all done in DNS with a records pointing to a static ip on my virtualhost."

    I think you need to dig deep to find where this 301 redirect is i.e. is it in the theme? is it in a plugin?

    If it were me at this point i would download the entire site and use Dreaweaver or an equivalent to scour every line of code in the site using "301" in the search find field.

    This may make it real easy to discover where the malfunction is at.

    I hope this helps to find where the 301 is coming from.

    Joe :slight_smile:

  • Jason
    • The Incredible Code Injector

    Thanks Joe, I'll download it and rar it in winrar and look for every "Header" command in php, which, there maybe QUITE a few, and removing one may make the thing where you type in redirect to malfunction.

    But what the heck, I'll try it anyway. Thanks for the nudge!

  • DavidM
    • DEV MAN’s Mascot

    Hi Jason,

    I've tagged a few of the other guys over here to see if they might have seen this before and know exactly where the issue's coming from. Definitely strange that sub-site article permalinks work but not the bare link to the site itself.


  • Jason
    • The Incredible Code Injector

    Thanks a ton DavidM, I REALLY appreaceate it. I hope I got my point across, this is ODD.

    I just noticed something new also, I'm going to look more into.

    When going to a subdomain that does not exist, at the very bottom it says:

    The site you were looking for, http:disappointed: does not exist, but you can create it now!

    Try this link for example:

    ?? Why that what?? lol a new symptom is great, something new to go off of finally!

  • Jason
    • The Incredible Code Injector

    Well I found some redirects in the wp-signup.php, but by that time the site had already redirected it TO that page... still looking.

    I also found similar behavior in another thread here, and the suggestion was to disable plugins. I will try this, but the other op is no longer a member here, and the thread was abandoned...

  • Jason
    • The Incredible Code Injector

    Well I think it's supposed to be there, but I see sunrise.php and dm_sunrise.php....

    Ok, I've researched, I was supposed to rename dm_sunrise.php to sunrise.php

    I'm going to test if it's actually getting executed and then brb...

  • pro120
    • Design Lord, Child of Thor

    So I'm noticing that your Sims subdomain site seems to be working fine, but not the domain mapped greencountry one is not.

    So you can also add a ? to the end of the home url and it works like a charm too.

    Just kinda winging it here but try adding this to the bottom of sunrise.php and refresh to see if everything looks alright.


    What I'm thinking is that the home url isn't firing some if() statement somewhere and buggin out. Maybe something to do with that error at the bottom of the page that doesn't print the url you tried to go to originally.

    Yea that sunrise.php rename should fix ya up I bet.

  • Jason
    • The Incredible Code Injector

    @pro120 I you have helped solved my problem!

    Can someone please confirm that it's working like it's supposed to on your end?


    Here's what happened, sunrise was indeed working, but by testing with it, I noticed something odd.

    after line #22 I added

    #22 $using_domain = $wpdb->escape( preg_replace( "/^www\./", "", $_SERVER[ 'HTTP_HOST' ] ) );
    #23 die( $using_domain);

    and I made note of the following: = = =

    So at first I thought, the php was returning the wrong host var, but then I realized it couldn't be because it was the same code pulling it in the subdirs.

    But I checked the DNS and that's where I stumbled across the problem. I'm using to protect against bots and etc, but it's turned OFF.

    Well the NS for are set to cloud flares. The NS for are set by the hosting provider. the A records for BOTH domains was the SAME IP. That's all good, BUT, somehow, not sure why, but I added as an "A record" for the nameservers, even though isn't using them....

    I guess the only way to describe it is voodoo or magic, because that makes no sense to me, but I'm sure it must be something to do with cloud flare. So hopefully anyone having this problem in the future can refer to this topic and maybe it will help them.

    And just for good weird measure, I have another host, with 12+ domains, in wordpress MU, and the old sunrise.php, and some are on cloudflare, some are not, and this is not a problem. :disappointed:

    Very big thanks to everyone who has followed my through this and offed some guidance! This day makes me very happy that I joined this community. I think I'll be staying around for a while!!

    Add new domains "A record" to your primary domain's cloudflare account in DNS settings, if you use cloud flare of course.

  • Jason
    • The Incredible Code Injector


    Thank's for those vars, I took so long writing my post, I missed you last response.

    I would like to make sure it's really working, and not just something that I goofed, but I'll try from my office tomorrow and see if it's still working.

    But yea, your dead on that the vars were not matching up. I wish I had know about those others at the time, but I got luck on a hunch when I saw that the wrong domain was being returned for the root.

    I *really hope* it was cloud flare.....

    ATM it's working in 3 browsers, but I had a lot of DNS cache flushing (repeatedly) to get it working....

    I used a service I googled to check if the page redirecting, and it was using php curl, so I avoiding the caching issues, so I wouldn't be relying too much on my browser.

    +Thanks a ton again Pro120!

  • Jason
    • The Incredible Code Injector


    The a record was was set to the correct dedicated ip in both nameservers, the problem what the the ns for which is cloudflare, also needed a copy of the a record for a domain which it has no authority over. To the best of my knowledge I not only had checked the dns (I mean, subpages were working for crying out loud)

    I DNS also cannot to 301 redirects, you were more right about downloading all the code and looking there. Somewhere in the mysteries of how cloudflare works, they were issuing a header redirect, to when asking for the hostname in php, and wordpress was redirecting to the main

    So it was the messed up php var that lead me to believe that the header packet wasn't coming from my own host at all, but cloudflare, which is a security service in the DNS layer. With normal DNS this shouldn't have been an issue, but my only guess was that CF was trying to avoid "malicious domain redirecting" or something, who knows. I do know they inject headers that php can use like what country the visitor is coming from. They are an easy free geoip provider that way also. So I know they're messing with the headers.

    You did help, so I thank you too, your efforts also helped provide me insight... I didn't mean to leave ya out Joe! :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.