• To change from a development URL to the production URL, i.e. change testdomain.com to proddomain.com for a new WordPress site, is there any reason why this would not work?

    1) Using PHPMyAdmin, back up the database (with DROP TABLE IF EXISTS, etc.) to SQL file.

    2) Use an editor to do a global search & replace testdomain.com -> proddomain.com.

    3) Restore the database from the edited SQL file.

    I know there’s a caution in the doc here about changing GUIDs, but this is all fresh with no posts, comments, or external references, so would seem OK.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Using an editor to do the replace will probably break your site, as URLs often occur in serialized data fields. Use the plugin “better search replace” to do the search/replace before you export the data. Then, just restore on the new server. You can replace the GUIDs or not; I usually do.

    Thread Starter rochrunner

    (@rochrunner)

    Steve, isn’t “serialized data” still just a long string of text in the .SQL file that could be changed by any code-oriented text editor? I did the export and looked at it in the Visual Studio Code Editor and it found 793 instances of the URL in what I have so far. Seems like the fact that it’s embedded in a longer string wouldn’t matter to the editor.

    Also, the site is not changing servers — just pointing a different domain to it — so this will be done in place. I’ve found a couple of plug-ins that are supposed to make the changes directly in the database, but thought that using export-modify-import might work just as well.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Look up serialized data. Use the process I outlined.

    Thread Starter rochrunner

    (@rochrunner)

    I see what you mean; there’s a byte-count involved. I’ll look up that plug-in. Thanks!

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    If you have wp-cli installed, you can use “wp search-replace old-value new-value”, too.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Would this work for changing site URL?’ is closed to new replies.