• Cryptocurrency
  • Earnings
  • Enterprise
  • About TechBooky
  • Submit Article
  • Advertise Here
  • Contact Us
TechBooky
  • African
  • AI
  • Metaverse
  • Gadgets
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
  • African
  • AI
  • Metaverse
  • Gadgets
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
TechBooky
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Home Open source

How to Safely Migrate a WordPress Site to a New Server (Step-by-Step Guide)

Paul Balo by Paul Balo
March 25, 2025
in Open source, Tips
Share on FacebookShare on Twitter

5. Changing the Site URL and Home URL in the Database

After migrating, one common issue is the site still trying to use the old URL. This is especially true if you are moving to a new domain or if you haven’t switched DNS and need to test the site at a temporary address. WordPress stores the site’s URL in the database (in the wp_options table) under the siteurl and home options. We need to update the site URL in the database so that WordPress knows it’s running on the new domain or new path.

When to change: If you are migrating to a different domain (e.g., from oldsite.com to newsite.com), you must update these. If you are keeping the same domain, but just moving servers, you typically do not change siteurl/home in the database (since the domain stays the same). In that case, you may skip this step, or only do it when you’re ready to flip DNS. However, when testing a migrated site before DNS switch (e.g., via hosts file or a staging subdomain), it can be useful to temporarily change the site URL so the site is accessible at the new location without redirecting back to the old domain.

There are a few ways to update these values:

  • Via SQL: You can run an SQL query on the new database (through phpMyAdmin or WP-CLI) to update the wp_options table. For example:

    UPDATE wp_options
    SET option_value = 'http://newsite.com'
    WHERE option_name IN ('siteurl','home');

    Replace 'http://newsite.com' with your new URL (make sure to include the correct protocol, http:// or https://, and no trailing slash). This query will set both the “WordPress Address (URL)” and “Site Address (URL)” to the new domain in one go. In phpMyAdmin, you can also simply browse the wp_options table, find the rows for siteurl and home, and edit them manually​, entering the new URL.

  • Via wp-config.php (temporary method): Alternatively, you can add the following two lines in wp-config.php to override the database values:

    define('WP_HOME', 'http://newsite.com');
    define('WP_SITEURL', 'http://newsite.com');

    This is a quick way to force WordPress to use the new URL (useful if you can’t access wp-admin due to URL issues). This should be removed later once the DB is properly updated, but it can get you into the admin to run search-replace operations.

  • Via WordPress Admin: If the site is already accessible on the new domain, you could log in and go to Settings -> General and change the WordPress Address and Site Address to the new URL. However, often right after migration you might not be able to log in until the URL is fixed, so this method isn’t always available.

Why this matters: If siteurl still points to the old domain, you may experience redirect loops or be sent back to the old site when trying to access the new one​. Updating these ensures the new site knows its correct address. For example, a common symptom is attempting to log in to wp-admin on the new server and getting bounced back to the old site’s login – that’s usually because siteurl/home are still the old URL, causing WordPress to redirect.

Go ahead and update siteurl and home in the database of the new site to reflect the new location. After doing so, if you access the site at the new URL (perhaps via your hosts file if DNS isn’t switched), the site should load from the new server without trying to reference the old domain. Keep in mind that this step alone only updates the core site address – many other URLs (like image links or page links in your content) may still point to the old domain, which we’ll handle next.

Related Posts:

  • WordPress theme switch
    A Comprehensive Guide to Resolving File Permissions…
  • wp-speculative-loading-plugin-page-speed-e1712935040275
    WordPress Launches Speculative Loading Plugin To…
  • blog5f352fc3b2393_wp
    Hackers Exploit Popular WordPress Backup Tool Used…
  • https___dev-to-uploads.s3.amazonaws.com_uploads_articles_kqmbj9rjwqfghln5r5jv
    How to Convert SQL Server to Postgres
  • how-to-export-imap-to-pst-file-format-in-simple-steps (2)
    How To Export IMAP To PST File Format In Simple Steps
  • images (2)
    The Untold Story of WordPress and WP Engine's Clash
  • assets_task_01jrfxkvwqeexbx349fmgw9baz_img_0
    Schema Markup in WordPress: A Step-by-Step Guide to…
  • WordPress_blue_logo.svg
    WordPress Launches Revolutionary 100-Year Domain…

Discover more from TechBooky

Subscribe to get the latest posts sent to your email.

Page 5 of 11
Prev1...456...11Next
Tags: tipswordpresswordpress migration
Paul Balo

Paul Balo

Paul Balo is the founder of TechBooky and a highly skilled wireless communications professional with a strong background in cloud computing, offering extensive experience in designing, implementing, and managing wireless communication systems.

BROWSE BY CATEGORIES

Select Category

    Receive top tech news directly in your inbox

    subscription from
    Loading

    Freshly Squeezed

    • How to Resolve Webcam Not Working in Windows 7 July 23, 2025
    • UK Outlaws Ransomware Payments by Government Agencies July 23, 2025
    • Threads Adds Enhanced Audience Insights July 22, 2025
    • Telegram Launches Cryptocurrency Wallets For U.S. Users July 22, 2025
    • Chinese Hackers Exploiting SharePoint Zero-day – Microsoft July 22, 2025
    • UK Government Signs OpenAI Deal for Public Service AI July 22, 2025

    Browse Archives

    July 2025
    MTWTFSS
     123456
    78910111213
    14151617181920
    21222324252627
    28293031 
    « Jun    

    Quick Links

    • About TechBooky
    • Advertise Here
    • Contact us
    • Submit Article
    • Privacy Policy
    Generic selectors
    Exact matches only
    Search in title
    Search in content
    Post Type Selectors
    • African
    • Artificial Intelligence
    • Gadgets
    • Metaverse
    • Tips
    • About TechBooky
    • Advertise Here
    • Submit Article
    • Contact us

    © 2025 Designed By TechBooky Elite

    Discover more from TechBooky

    Subscribe now to keep reading and get access to the full archive.

    Continue reading

    We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.