WordPress.org

Ready to get started?Download WordPress

Forums

WordPress MU Domain Mapping
WP MU Sub-folder - Mapped Domain - Images Failure (7 posts)

  1. dasped
    Member
    Posted 1 year ago #

    Hi Ron & Community

    Nightmare scenario… !

    Just got ourselves into launch – all systems go.

    Built the site via WP Multisite (Additional sites built under) sub folders. All latest versions - WP & Plugin etc.

    Just dropped our old site today, parked and mapped the domain, awaited propagation and boom – No images!

    All revolution header slides work fine but all under visual composer (Theme Integrated!) do not. (Apologies for link but I felt it necessary for your understanding)
    For hours I have mulled it over and thought it was htppd.conf allowoverride all issue or htaccess.

    Then, I looked into a multisite on same network that was half built – prior to V3.0 of the theme (Prior to visual composer) All images work fine! (I have not updated posts/pages to work with visual composer yet)

    My problem is because the visual composer creates shortcodes example:

    imageeffect image=”1854″ align=”aligncenter” target=”_self”

    We have in effect lost:

    img src=”/wp-content/uploads/sites/2/2013/04/my-image.png” alt=”" width=”250″ height=”300″

    Multisite, or more to the point - a mapped domain is clearly not finding the images to display them. (Prior to mapping images show fine via mytld.com/my-site/) But customers and word of mouth new comers will not find us etc.

    I could go through each page and edit as text but we are talking about 60+ pages, a couple containing 50+ images! And this would certainly cause page edibility issues down the line.

    I've just dropped my previous sales site and hopped onto new billing system the whole she-bang so, can not even revert back. Rather anxious and seriously hoping someone can pull me out of the creek with some ideas or a solid work around ASAP.

    Upset and panicked is an understatement - Here’s hoping (With crossed fingers and toes)…..

    Thanks in advance.
    Sped

    http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/

  2. dasped
    Member
    Posted 1 year ago #

    If I check the links being generated from the images that are not being displayed I can see that this is how the links are being affected.

    my-site.co.ukhttp//my-master-mu-dom.co.uk/my-site-sub-folder/wp-content/uploads/sites/2/2013/02/my-image.jpg

    Thought this may help?

  3. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 1 year ago #

    When you map a domain add the domain to the text box not the URL (ex. use domain.com not http://domain.com).

  4. Pablo @ vDevices
    Member
    Posted 1 year ago #

    @dasped,

    Have you tried this: Patch?

  5. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 1 year ago #

    @Pablo - I appreciate you pitching in to help. However, the link provided by the OP showed the mapped domain beginning with http//.

    The patch that you had in the other thread would not help when the issue is a mangled domain.

  6. EliasArtista
    Member
    Posted 10 months ago #

    I had this problem to. And I have rezolve it myself. It is a sunrise.php problem.
    Edit your sunrise.php
    Replace your code (everything) from sunrise.php with this new code:

    <?php
    // Compatibility mode
    define('DM_COMPATIBILITY', 'yes');

    // domain mapping plugin to handle VHOST and non VHOST installation
    global $wpdb;

    // No if statement needed as the code was the same for both VHOST and non VHOST installations
    if(defined('DM_COMPATIBILITY') && DM_COMPATIBILITY == 'yes' ) {
    if(!empty($wpdb->base_prefix)) {
    $wpdb->dmtable = $wpdb->base_prefix . 'domain_mapping';
    } else {
    $wpdb->dmtable = $wpdb->prefix . 'domain_mapping';
    }
    } else {
    if(!empty($wpdb->base_prefix)) {
    $wpdb->dmtable = $wpdb->base_prefix . 'domain_map';
    } else {
    $wpdb->dmtable = $wpdb->prefix . 'domain_map';
    }
    }

    if(defined('COOKIE_DOMAIN')) {
    define('COOKIE_DOMAIN_ERROR', true);
    }

    $wpdb->suppress_errors();

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

    // Check for the domain with and without the www. prefix
    $mapped_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->dmtable} WHERE domain = %s OR domain = %s LIMIT 1 /* domain mapping */", $using_domain, 'www.' . $using_domain ) );

    $wpdb->suppress_errors( false );

    if( !empty($mapped_id) ) {
    $current_blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = %d LIMIT 1 /* domain mapping */", $mapped_id) );
    $current_blog->domain = $_SERVER[ 'HTTP_HOST' ];

    $blog_id = $mapped_id;
    $site_id = $current_blog->site_id;

    define( 'COOKIE_DOMAIN', $using_domain );

    $current_site = $wpdb->get_row( $wpdb->prepare( "SELECT * from {$wpdb->site} WHERE id = %d LIMIT 0,1 /* domain mapping */", $current_blog->site_id ) );
    // Add in the blog id
    $current_site->blog_id = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs} WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path) );

    $current_site = get_current_site_name( $current_site );

    $current_blog->path = $current_site->path;

    define( 'DOMAIN_MAPPING', 1 );

    // Added for belt and braces
    if ( !defined('WP_CONTENT_URL') ) {
    $protocol = ( ( isset( $_SERVER[ 'HTTPS' ] ) && 'on' == strtolower( $_SERVER[ 'HTTPS' ] ) ) || ( isset( $_SERVER[ 'SERVER_PORT' ] ) && '443' == $_SERVER[ 'SERVER_PORT' ] ) ) ? 'https://' : 'http://';
    define( 'WP_CONTENT_URL', $protocol . $current_blog->domain . $current_blog->path . 'wp-content'); // full url - WP_CONTENT_DIR is defined further up
    }

    }

    if ( !defined( 'SUNRISE_LOADED' ) )
    define( 'SUNRISE_LOADED', 1 );

    // let the site admin page catch the VHOST == 'yes'
    $wpdb->dmtable = $wpdb->base_prefix . 'domain_mapping';
    $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 );
    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 = $_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}'" );
    if( function_exists( 'get_current_site_name' ) )
    $current_site = get_current_site_name( $current_site );

    define( 'DOMAIN_MAPPING', 1 );
    }
    ?>

  7. EliasArtista
    Member
    Posted 10 months ago #

    Belive me this will Work.
    I have tried everything. But only this works.
    That code is made from 2 difrent sunrise.php files of Mu Domain Mapping and Domain Mapping from DEV.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic