• Resolved tcline

    (@tcline)


    I’ve had a subdomain multisite for many years. I decided to separate my different writings into different sub sites, like flying.mapped-domain.com, invest.mapped-domain.com, photography.mapped-domain.com etc. and keep my mapped-domain the front landing page with links to the subdomains. I messed something up, because all was fine for about 4 DNS hours, and now https://www.mapped-domain.com forwards to invest.mydomain.com, one of my sub sites, and I can’t get it back.

    I’ve reinstalled WP, changed themes, and deactivated plugins. Even the back-end WP Admin pages forward to my invest sub-site. The only way to see my main landing page domain is to take it out of mapping and access it by it’s subdomain: mapped-domain.my_main_multisite_domain.com

    MyMultisite.com – works
    Mapped_Domain.com – forwards to invest.Mapped_domain.com 24/7, sadly.
    Mapped_Domain.MyMultisite.com – works when not mapped. But as soon as I map it back to Mapped_Domain.com, it forwards to invest.Mapped_Domain.com (even the WP Admin pages).

    Thanks for any help – I’m *no* php/htaccess whiz, but I suspect somewhere in the code/database, there is a lingering link that switching my mapping didn’t change.

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Is it a clean reinstall or did you restore the site? Are the sites properly mapped in the multisite settings?

    Any wildcard or redirections in you hosting panel?

    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

    That sounds more like a mapping issue in your hosting, not WordPress. May be your hosting tech support can help you find out if there are any issues

    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.

    I don’t think that it has to be scrapped. May be do a database search to find the wrong forwarding?

    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)

    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)

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

    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.

    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.

    I’m not sure either. I did some further research, and I found out that the sunrise.php is required for some mapping plugin, also that you could try updating it or just removing it. I don’t recommend removing a core file, your solution is good for now. May be a core developer can shed a light on this.

    • This reply was modified 3 years, 2 months ago by a2hostingrj. Reason: a word
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘One of my subsites forwards to another of my subsites by mistake’ is closed to new replies.