Error updating Domain Mapping Plugin - Sunrise ON

Hi Guys, I Try to update domain mapping plugin but it didin't work. When I try to access a map domain: http://www.mindtv.com.br it get backs to home or register page.
When I try to access Settings - Domain Mapping I get this:
´Please edit your /home1/marcelo/public_html/wp-config.php and move the line define( 'SUNRISE', 'on' ); above the last require_once() in that file or make sure you updated sunrise.php.´

I already try to edit wp-config.php or use the old sunrise.php, but nothing changes. Any ideas?
thanks.

  • Marcelo Leite
    • WPMU DEV Initiate

    I'm Using this sunrise.php:

    <?php
    
    if ( defined( 'COOKIE_DOMAIN' ) ) {
    	die( 'The constant "COOKIE_DOMAIN" is defined (probably in wp-config.php). Please remove or comment out that define() line.' );
    }
    
    global $wpdb;
    
    $using_domain = $wpdb->escape( preg_replace( "/^www\./", "", $_SERVER[ 'HTTP_HOST' ] ) );
    
    if ( preg_replace( "/^www\./", "", DOMAIN_CURRENT_SITE ) !== $using_domain ) {
    	$md_domains = unserialize( $wpdb->get_var( "SELECT meta_value FROM {$wpdb->sitemeta} WHERE meta_key = 'md_domains' AND site_id = 1" ) );
    
    	if( is_array( $md_domains ) ) {
    		if( $_SERVER['REQUEST_URI'] == '/' ) {
    			foreach ( $md_domains as $domain ) {
    
    				if( $_SERVER['HTTP_HOST'] == strtolower( $domain['domain_name'] ) ) {
    					$location = 'http://' . DOMAIN_CURRENT_SITE;
    
    					if ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) == true || strpos( $_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer' ) == true ) {
    						header( "Refresh: 0;url=$location ");
    					} else {
    						if ( php_sapi_name() != 'cgi-fcgi' )
    							status_header($status); // This causes problems on IIS and some FastCGI setups
    						header( "Location: $location", true, 301 );
    					}
    
    					die;
    				}
    
    			}
    		}
    
    		foreach( $md_domains as $domain ) {
    			if ( preg_match( '|' . strtolower( $domain['domain_name'] ) . '$|', $using_domain ) ) {
    				define( 'COOKIE_DOMAIN', '.' . strtolower( $domain['domain_name'] ) );
    				break;
    			}
    		}
    	}
    }
  • aristath
    • Recruit

    You'll have to use the dm_sunrise.php file that's included in the domain mapping plugin instead of the one provided in multi-domains,.

    Just grab that file, copy it to your wp-content folder and rename it to sunrise.php

    Let me know if that works for you.

    Cheers,
    Ari.

  • Marcelo Leite
    • WPMU DEV Initiate

    I sent dm_sunrise.php to sunrise.php in wp-content/ but I still get this:

    Please edit your /home1/marcelo/public_html/wp-config.php and move the line define( 'SUNRISE', 'on' ); above the last require_once() in that file or make sure you updated sunrise.php.

  • Marcelo Leite
    • WPMU DEV Initiate

    Hello @Ariasth didn't work. I Don't remember what is show in this page:
    wp-admin/network/settings.php?page=dm_domains_admin

    but in the sub domain sites the admin panel is working fine.. I think I'm gonna close this subject, I Don't know what else more I could do...

    Thank You for your help!

  • Marcelo Leite
    • WPMU DEV Initiate

    Hi @aristath now I have 2 "Domain Mapping" inside the Settings menu, one of then is showing that message. The other one is showing
    "If you are having problems with domain mapping you should try removing the following lines from your wp-config.php file:.

    define( 'DOMAIN_CURRENT_SITE', 'noaraguaia.com.br' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );
    Note: If your domain mapping plugin is WORKING correctly, then please LEAVE these lines in place."

    but the mapped domains are working fine so I'm afraid to change it.. so I think is ok..
    thank you for your help
    My Best Regards

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.