WordPress.org

Ready to get started?Download WordPress

Forums

Adding www to the Domains of a Multisite Network (5 posts)

  1. wp.newbie
    Member
    Posted 1 year ago #

    Hi, is there a way to still change the domain names in a Multisite Network setup once they've been mapped?

    I'm trying to add a www prefix to both the primary domain and the mapped domain so that primarydomain.com becomes http://www.primarydomain.com and mappeddomain.com becomes http://www.mappeddomain.com.

    Hope someone would be able to help. Thanks so much.

  2. Krishna
    Volunteer Moderator
    Posted 1 year ago #

  3. wp.newbie
    Member
    Posted 1 year ago #

    Thanks Krishna, found it a bit complicated so I just did a reinstall...

  4. Krishna
    Volunteer Moderator
    Posted 1 year ago #

    Did the reinstall solve your problem? If so, please mark the topic as marked.

  5. j3d3s3
    Member
    Posted 1 year ago #

    ***SOLUTION***

    I have successfully converted my multisite from non-www to www using the following method. Please be cautious and backup your db before doing it. Also read all the following instructions completely before starting the process.

    1. edit wp-config.php and change
    from
    define(‘DOMAIN_CURRENT_SITE’, ‘mydomain.com’);
    to
    define(‘DOMAIN_CURRENT_SITE’, ‘www.mydomain.com’);

    2. get the search & replace script from https://github.com/interconnectit/Search-Replace-DB and read the instructions on the site on how to use it.
    It is straightforward as explained below. Put the downloaded script in your website home folder and go to http://mydomain.com/searchreplacedb21.php
    step1: select the pre-populate the db values option and clik submit
    step2: check your pre-populated db details and click submit
    step3: select the tables (select 10 at a time: If you select all of them, the script execution time might exceed and would fail. So either select few tables at a time or increase your script execution time in your php.ini). Do not select “Leave GUID column unchanged”, so leave this unselectecd. Because this is the reason (to update GUID) we are using this script to update the db.
    step4: search for “http://mydomain.com” and replace with “http://www.mydomain.com”. ***NOTE***: here make sure to put the http:// infront of your domain in your search terms, because you will have entries in the db for folders such /home/blahblah/public_html/mydomain.com and you do not want to replace these instances. So you have to search and replace for http://mydomain.com to http://www.mydomain.com
    step5: The results shown on how many are replaced on the selected tables. Now use browser’s back button to go back to step3 and select the next set of tables and continue the process until you finish all the tables.

    3. During the search & replace process, let us say you would start search and replace from http://mydomain.com/searchreplacedb21.php and in the middle it might say permission denied. Because for the main domain the path would have already changed to http://www.mydomain.com. So if this happens visit http://www.mydomain.com/searchreplacedb21.php and restart the process and complete the search and replace for all the tables.

    4. delete the file searchreplacedb21.php from your domain.

Topic Closed

This topic has been closed to new replies.

About this Topic