WP Tuts Hub

Browse

  • Home
  • Categories
    • WordPress & AI
    • WordPress Security
    • WordPress Troubleshooting
    • WordPress Tips and Tricks
    • SSH (Secure Shell)
    • WordPress Insights
    • WordPress Common Facts
    • Series Tutorials
  • WordPress Tools
    • All tools
    • Error decoder
    • Redirect tester
    • URL replace
    • wp-config helper
    • Plugin Suggestor (AI)
    • Snippet Studio
    • Permalinks builder
    • Conflict triage
    • Log decoder
  • My Plugins
  • Contact Me
  • About WP Tuts Hub
Home/WordPress Domain Change SQL Generator

URL replace

WordPress Domain Change SQL Generator

Moving WordPress to a new domain, or from http:// to https://? Enter the old and new site URL to get the exact WP-CLI commands and SQL queries that replace it across the database, without breaking serialised data. Everything is generated in your browser.

Private · runs in your browser · nothing uploaded Private · in-browser
All tools Tools

URL replace

Replace the old site URL without breaking the database

Options

Check Waiting
    WP-CLI commands

    Export the database before you run anything. The dry run writes nothing.

    How the domain change generator works

    WordPress stores its own address in thousands of places: the two site address settings, links and image URLs inside every post, post meta, widgets, theme settings and plugin options. Changing the address in Settings updates only the first two. This tool builds the commands that update the rest.

    The WP-CLI tab gives you a backup command, a dry run that writes nothing, and the real wp search-replace run. The SQL tab gives plain queries for phpMyAdmin when you have no shell access. The Check panel compares the two URLs and tells you whether plain SQL is safe for your move.

    The tool never connects to your site or database. It only writes text for you to copy, and you decide what to run.

    Example

    Moving from http://old-site.com to https://new-site.com with the prefix wp_ produces this dry run:

    wp search-replace 'http://old-site.com' 'https://new-site.com' \
      --all-tables-with-prefix --precise --skip-columns=guid \
      --report-changed-only --dry-run

    and this first SQL query:

    UPDATE wp_options SET option_value = REPLACE(option_value, 'http://old-site.com', 'https://new-site.com')
    WHERE option_name IN ('home', 'siteurl');

    The Check panel also warns that the new URL is one character longer, so the SQL tab skips serialised values and points you to WP-CLI for a complete replace.

    Questions and answers

    Why can a simple SQL REPLACE break a WordPress site?

    Widgets, theme settings and many plugin options are stored as serialised PHP, which records the length of every string, for example s:19:"http://old-site.com". If the new URL has a different length, the recorded number no longer matches and WordPress discards the whole value. wp search-replace rewrites those lengths correctly; a plain SQL REPLACE does not.

    What can I do without WP-CLI or shell access?

    Run the queries from the SQL tab in phpMyAdmin. They update posts, comments and plain meta values, and skip serialised data. Then use a search-and-replace plugin that understands serialised data, such as Better Search Replace, for widgets and settings.

    Should I change post GUIDs?

    Usually not. The GUID is a permanent identifier that feed readers use to recognise a post. Changing it on a site that has already been live makes them show old posts as new. Change GUIDs only when moving a development copy to its first live address.

    Where do I find the table prefix?

    In wp-config.php, on the line that starts with $table_prefix. The default is wp_.

    The site still redirects to the old address. Why?

    Check wp-config.php for WP_HOME and WP_SITEURL. Those constants override the database, so change them there. Then clear every cache: the object cache, any page cache plugin and your CDN.

    Related tutorials

    • How to Replace Old URLs After a WordPress Domain Change
    • How to Create a WordPress Admin User via MySQL (phpMyAdmin)
    • SSH Commands Cheat Sheet for WordPress Developers

    All WordPress tools · related: Redirect & Rewrite Rule Tester · .htaccess & Permalinks Generator

    WP Tuts Hub

    WordPress tutorials, themes, and plugins — written for builders.

    Topics

    • WordPress & AI
    • WordPress Security
    • WordPress Development
    • WordPress Troubleshooting
    • WordPress Tips and Tricks

    Resources

    • WordPress Tools
    • My Plugins
    • Portfolio
    • About WP Tuts Hub
    • Contact Me

    © 2026 WP Tuts Hub · Md. Zubaer Ahammed

    Privacy Policy Terms of Use