Support » Plugin: WP Multi Network » [Plugin: WP Multi Network] wp-signup.php redirect-loop

  • I was getting a redirect error on the main site on my sub network
    Well found out what’s causing the problem here:

    It has to do with the code that is in wp-signup.php in lines 25 -33

    if ( !is_multisite() ) {
    wp_redirect( get_option( 'siteurl' ) . "/wp-login.php?action=register" );
    if ( !is_main_site() ) {
    wp_redirect( network_home_url( 'wp-signup.php' ) );

    WordPress doesnt allow signups on subsites. When someone tries to sign up on a sub site, it redirects them to the main site.
    I am using the multi network plugin,
    even though a site may be the main site for an additional network, wordpress still sees it as being a subsite so it keeps redirecting in an endless loop. By commenting out those lines it fixed the problem.

    Is there a way to make a plugin for this instead of having to hack core?

Viewing 15 replies - 1 through 15 (of 15 total)
  • jazbek


    Hi, were you ever able to solve this without hacking core? I am having the same issue.



    Actually I was able to fix this without hacking the core — I used a slightly modified version of the sunrise.php file that comes with

    First, you must go into your wp-config.php file and uncomment or add this line:

    define( 'SUNRISE', 'on' );

    (I added it right after define(‘WP_ALLOW_MULTISITE’, true); )

    And then create wp-content/sunrise.php and paste the following in:

    if ( defined( 'COOKIE_DOMAIN' ) ) {
        die( 'The constant "COOKIE_DOMAIN" is defined (probably in wp-config.php). Please remove or comment out that define() line.' );
    // let the site admin page catch the VHOST == 'no'
    $dm_domain = $wpdb->escape( $_SERVER[ 'HTTP_HOST' ] );
    if( ( $nowww = preg_replace( '|^www\.|', '', $dm_domain ) ) != $dm_domain )
        $where = $wpdb->prepare( 'domain IN (%s,%s)', $dm_domain, $nowww );
        $where = $wpdb->prepare( 'domain = %s', $dm_domain );
    $domain_mapping_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->sites} WHERE {$where} ORDER BY CHAR_LENGTH(domain) DESC LIMIT 1" );
    $wpdb->suppress_errors( false );
    if( $domain_mapping_id ) {
        $current_blog = $wpdb->get_row("SELECT * FROM {$wpdb->blogs} WHERE blog_id = '$domain_mapping_id' LIMIT 1");
        $current_blog->domain = $_SERVER[ 'HTTP_HOST' ];
        $current_blog->path = '/';
        $blog_id = $domain_mapping_id;
        $site_id = $current_blog->site_id;
        define( 'COOKIE_DOMAIN', $_SERVER[ 'HTTP_HOST' ] );
        $current_site = $wpdb->get_row( "SELECT * from {$wpdb->site} WHERE id = '{$current_blog->site_id}' LIMIT 0,1" );
        $current_site->blog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" );
        define( 'DOMAIN_MAPPING', 1 );

    I’m having the same issue and its driving me nuts.
    I have multi-site and multi-network setup.
    I tried the modified sunrise.php code above but when i go back to the domain mapping admin, i get an error asking me to move the define( ‘SUNRISE’, ‘on’ ); line above the last require_once in wp-config.
    wp-config.php has no require_once code.
    you mention you used a modified version of the domain-mapping plugin. is the sunrise.php modification the only modification? or is there another download apart from the official one that i should be using?

    Yeah, I am not using the Domain Mapping plugin, I only borrowed their sunrise.php and modified it.

    That sounds like a strange error message about the SUNRISE line.. there is a require_once but it’s very the last line of wp-config.php. — require_once(ABSPATH . ‘wp-settings.php’);

    I have my define( ‘SUNRISE’, ‘on’ ); just above the “Authentication Unique Keys and Salts.” section.

    Where do you have yours?

    I have the defin(‘SUNSRISE’,’on’); pretty much where you have it.
    Ok, so what i’m getting is that you just use the sunrise.php but not the whole domain mapper plugin.
    I’m actually using the plugin.
    In saying that, how so you map your child blogs to domains?
    My situation is as such. I have a parent site/network, and i have about 3 child sites. Only one of those i need to have user registrations, but i dont want the users registering to have to sign up to the parent site/network. I want them to sign up to that child site on its own domain.
    Is this how you have things setup?
    thanks in advance for your help

    I’m only using the Multi-Network plugin, and I’m not mapping child blogs to domains. I’m just creating different parent domains (networks) with children under each one.

    yours probably works like this: -> ->

    mine lis like this:

    Personally, I can’t really grasp why you would ever need to use the Domain Mapping plugin, now that the Multi-Network plugin is out. I have talked to another person who is using both (like you are), and I didn’t understand their reasoning. With Multi-Network, you can just directly create any number of networks (parent domains) and child sites (subdomains) under those networks.

    I also want someone to be able to register on the subdomains (not the parent domains). I’m planning to set it up so that when they register on a subdomain, they’re automatically added to all the domains on that network.


    Also — I should mention that if you edit the sunrise.php to use my version above, there’s a good chance it’s breaking the Domain Mapping plugin, so that might be why you’re getting that error.

    I’m starting to get your point of the irrelevance of the domain mapping when you have the multi-network.
    I might have to reevaluate my setup in lieu of the child site registration issue. I just might have to make it that i just have a series of networks, instead of network and child sites.
    in saying that, how do you map a domain to the 2nd & 3rd network with the multi-network plugin?
    my ideal situation is this -> -> -> ->

    with each of those child sites, a user can register to it directly without being bumped up to the network domain.

    Not sure how to make that work without a lot of hacking

    dont bother answering the question about the domains for the other networks!

    on more thing, if i already have a child site, and want to turn that into a network, is that possible?

    I just tried setting up a brand new wp install, with multi-site enabled, and installed the multi-network plugin. also used your sunrise.php script as you described.
    I created a second network and i’m still not able to register a user on a second network. it goes in to a loop as before and the craps out.
    am i missing something?

    right so in the end, all i had to do really was to remove the following lines from the wp-config.php for a second network to get the wp-signup.php going.

    define( 'DOMAIN_CURRENT_SITE', '' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    and it seemed to all work fine. in a network, the child site still redirects to the parent for login.

    I am trying to setup the following

    I have 2 sites setup
    that is setup with the wp network

    I would like users on my second domain to be able to register
    I would like them to register FROM the domain they are currently visiting

    how do I stop from redirecting to while still maintaining the functionality of the registration page

    jazbek:Personally, I can’t really grasp why you would ever need to use the Domain Mapping plugin, now that the Multi-Network plugin is out. I have talked to another person who is using both (like you are), and I didn’t understand their reasoning. With Multi-Network, you can just directly create any number of networks (parent domains) and child sites (subdomains) under those networks.

    Does Mult-Network plugin do domain mapping? Or is it just that you don’t see any reason to map domains?

    This may be a topic for another post but I am confused by this comment by jazbek and I’m hoping to understand this better. It’s possible that I’m simply confused about how to get domain mapping working on my network and so I’m looking for evidence of my sanity.

    I don’t see any reason to map domains. That comment was old (pre-WP 3.1). Now that 3.1 is out, I don’t see the need for either plugin, now that a multi-network management interface is built into the core.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘[Plugin: WP Multi Network] wp-signup.php redirect-loop’ is closed to new replies.