Changing Multisite Domain

Hi there i am having trouble after following the changing mutisite Domain Tutorial. I followed the tutorial to the letter but when i try and access wp-admin i get the cant establish database connection error message and am not sure why Thanks Phil

  • Predrag Dubajic

    Hey Phil,

    Hope you're doing well today :slight_smile:

    Can you tell us which guide you were following to make this change?

    If the error is showing database connection error did you made sure that in your database there are no leftovers of old domain?

    You can use something like this to go through your database and replace old domain with the new one:

    UPDATE wp_options SET option_value = replace(option_value, 'http://OLDDOMAIN.COM', 'http://NEWDOMAIN.COM') WHERE option_name = 'home' OR option_name = 'siteurl';
    
    UPDATE wp_posts SET guid = replace(guid, 'http://OLDDOMAIN.COM','http://NEWDOMAIN.COM');
    
    UPDATE wp_posts SET post_content = replace(post_content, 'http://OLDDOMAIN.COM', 'http://NEWDOMAIN.COM');
    
    UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://OLDDOMAIN.COM','http://NEWDOMAIN.COM');

    Best regards,
    Predrag

  • Adam Czajczyk

    Hello Phil!

    Could you please give one other tool a try? What my colleague Predrag suggested is a great solution but based on what you have found it seems that there may be some more locations where an old domain is stored and that may be a serialized data that should be treated in a different way.

    I always find this script extremely useful and I always recommend it as it's completely free and I never experienced any troubles with it:

    https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

    It's a standalone script so you don't install it in WordPress but just put on a server. There's an easy to follow guide directly on the download page. The script includes a "dry run" option that doesn't actually make any changes to the database but helps you evaluate it and see if changes are necessary. It should be able to update all possible occurrences of old domain in the database.

    Let me know if that helped please.

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.