Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Looks like it’s working now? When I click on the Menu for the “Area” pages, I get to new sites, and am not redirected to the main site.

    Thread Starter tcline

    (@tcline)

    I downloaded a fresh copy of the sunrise.php file from the old WordPress MU plugin page. It was the same as I had in my install, so no news on that front.

    However, for better or worse, I simply commented out of my wp-config.php file the SUNRISE ON line:

    
    /** Sets up WordPress vars and included files. */
    /* define( 'SUNRISE', 'on' ); */
    

    All my mapped domains run fine now, and there are no errors on the server or when DEBUG is set to TRUE. I’m not sure what sunrise.php was used for – maybe deprecated from the old MU plug-in days? Anyway, I’ll leave this here in hopes it can help someone else.

    Thread Starter tcline

    (@tcline)

    Well, it’s definitely my sunrise.php file. When I remove this file from the wp-content folder, everything works great. My mapped domain, my subdomain, my main multisite domain. But if I put it back in there, my mapped domain goes back to a 500 error with the above error codes.

    Is there any way to get a fresh/uncorrupted version of a new sunrise.php file? I’ve clicked the “re-install WordPress” button but that hasn’t done it. In case anyone reads code, my current sunrise file that I removed is copied below.

    <?php
    if ( !defined( 'SUNRISE_LOADED' ) )
    	define( 'SUNRISE_LOADED', 1 );
    
    if ( defined( 'COOKIE_DOMAIN' ) ) {
    	die( 'The constant "COOKIE_DOMAIN" is defined (probably in wp-config.php). Please remove or comment out that define() line.' );
    }
    
    $wpdb->dmtable = $wpdb->base_prefix . 'domain_mapping';
    $dm_domain = $_SERVER[ 'HTTP_HOST' ];
    
    if( ( $nowww = preg_replace( '|^www\.|', '', $dm_domain ) ) != $dm_domain )
    	$where = $wpdb->prepare( 'domain IN (%s,%s)', $dm_domain, $nowww );
    else
    	$where = $wpdb->prepare( 'domain = %s', $dm_domain );
    
    $wpdb->suppress_errors();
    $domain_mapping_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->dmtable} 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 = $dm_domain;
    	$current_blog->path = '/';
    	$blog_id = $domain_mapping_id;
    	$site_id = $current_blog->site_id;
    
    	define( 'COOKIE_DOMAIN', $dm_domain );
    
    	$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}'" );
    	if ( function_exists( 'get_site_option' ) )
    		$current_site->site_name = get_site_option( 'site_name' );
    	elseif ( function_exists( 'get_current_site_name' ) )
    		$current_site = get_current_site_name( $current_site );
    
    	define( 'DOMAIN_MAPPING', 1 );
    }
    Thread Starter tcline

    (@tcline)

    I’m now getting a 500 error on my troubled domain. The subdomains still work great.

    Changing the wp-config to: ‘WP_DEBUG’, true
    No errors on any sub domains, but my troubled mapped domain, I get:

    Warning: Creating default object from empty value in /public_html/wp-content/sunrise.php on line 22
    
    Notice: Undefined property: stdClass::$site_id in /public_html/wp-content/sunrise.php on line 25
    
    Notice: Undefined property: stdClass::$site_id in /public_html/wp-content/sunrise.php on line 29
    
    Notice: Trying to get property 'domain' of non-object in /public_html/wp-content/sunrise.php on line 30
    
    Notice: Trying to get property 'path' of non-object in /public_html/wp-content/sunrise.php on line 30
    
    Warning: Creating default object from empty value in /public_html/wp-content/sunrise.php on line 30

    Apparently my sunrise.php file has issues. DuckDuckGo doesn’t help me much with that file. Any thoughts here? ETA: I think there is a Site ID numbering issue where my mapped domain is lost somewhere. But this is showing up in my server error log as well.

    • This reply was modified 3 years, 2 months ago by tcline. Reason: site id info
    Thread Starter tcline

    (@tcline)

    My domain with my name forwards to the investing site no matter where I put the investing site, lol. This is crazy!

    When I place my investing site in a sub domain of my main multisite domain, the https://www.myname.com forwards to that sub domain. See here.

    When I place my investing site in a sub domain of my mapped domain, the https://www.myname.com forwards to that sub domain. See here.

    Finally, when I set my investing site to my mapped domain, it stays put, seen here.

    It seems, no matter what I do, WP can’t let go of my mapped name domain. I’ll try a database search, but I’m not sure what I’d look for or find.

    Thread Starter tcline

    (@tcline)

    Sadly Bluehost said they won’t help with WP issues. There aren’t any directs involved at the host or DNS level. I suspect there is an issue in my database or with the WP code somewhere. The mapping function in WP is clinging on to the old link of my mappeddomain.com and sending it to my new mapped subdomain. I may have to scrap the whole project and start fresh. Frustrating for sure.

    Thread Starter tcline

    (@tcline)

    Thanks for the feedback.
    Yes, the sites are properly mapped, they have been for many years, about 12 sites in total.
    Yes, I have a wildcard setup at Bluehost.
    No, this isn’t a clean install, I’ve been using this multisite for many years.

    Going awry: I had the investment site under my mapped domain (my name linked above) for a few weeks, then moved it to the invest subdomain. That worked great, and my mapped domain was then empty. I then created a new site for my mapped domain, and used it as a landing page for all my mapped domain’s subdomains (flying, invest, etc). A few hours later, my mapped domain started forwarding to the invest subdomain, even the WP Admin pages do.

    Not sure what to fix.

    • This reply was modified 3 years, 2 months ago by tcline. Reason: spelling

    @plymouthunitedorg I can confirm that @jeremy’s advice solved my problem and there was no disconnect problems with the data. If you give this a try, I hope it works for you, too. Good luck!

    Thanks Jeremy! I hope this works for us with this problem. btw esmi, yes, I’m using a child theme ??

    This same thing happened to me. I want to try what Jeremy suggests, but I’m afraid to. I don’t want to lose all my Jetpack stats and more importantly, I don’t want everyone who has signed up to follow my site to have to re-sign up. Will disconnecting and reconnecting cause this? Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)