WP Tuts Hub

WordPress Tutorials, Themes and Plugins Hub
Advertisement

Browse

  • Home
  • Categories
    • WordPress Troubleshooting
    • WordPress Tips and Tricks
    • SSH (Secure Shell)
    • WordPress Insights
    • WordPress Common Facts
    • Securing WordPress
  • Series Tutorials
    • Advanced WordPress Topic
  • Privacy Policy
  • Terms of Use
  • Contact Me
  • About WP Tuts Hub
Home/WordPress Common Facts/WordPress Replace Old URL After Domain Change
WordPress Common Facts
September 27, 2016

WordPress Replace Old URL After Domain Change

  • WordPress Common Facts
  • WordPress Insights
  • WordPress Tips
  • WordPress Tricks

In this article, I will show you an effective way of updating domain name of a WordPress site after changing the domain. We will do it in two ways: i) Manually with SQL commands and ii) Automatically with a Plugin. I do insist on backing up your WordPress site’s database before proceeding with this tutorial.

How to Replace Old URL After Domain Change in WordPress (Step by Step):

Step 0 Before you go ahead with this step by step tutorial make sure that you have a backup of your Database.

Step 1 Login to your cPanel and Click on PHPMyAdmin.

Step 2 Select the database of your website and click on “SQL” tab.

Update WordPress site URL via PHPmyadmin

Step 4 Paste the following code into the SQL command box.

Important:

Note 1: Update the wp_ table prefix according to your website’s database table prefix. In my case, it’s “wpdb_“. So, I shall replace “wp_”  with “wpdb_“.

Note 2: Replace “OLD_WEBSITEURL.COM” with your old website domain name and “NEW_WEBSITEURL.COM” with your new domain name.

So, for my case the final codes will look like this:

update wpdb_options set option_value = replace(option_value, 'http://OLD_WEBSITEURL.com', 'http://NEW_WEBSITEURL.com');
update wpdb_postmeta set meta_value = replace(meta_value, 'http://OLD_WEBSITEURL.com', 'http://NEW_WEBSITEURL.com');
update wpdb_posts set post_content = replace(post_content, 'http://OLD_WEBSITEURL.com', 'http://NEW_WEBSITEURL.com');
update wpdb_posts set guid = replace(guid, 'http://OLD_WEBSITEURL.com', 'http://NEW_WEBSITEURL.com');
update wpdb_posts set pinged = replace(pinged,'http://OLD_WEBSITEURL.com', 'http://NEW_WEBSITEURL.com');
update wpdb_comments set comment_content = replace(comment_content, 'http://OLD_WEBSITEURL.com', 'http://NEW_WEBSITEURL.com');

Step 5 Press “GO” button and you are done.

 

Update WordPress site Domain Name Automatically with a Plugin:

For some users working directly with PHPMyAdmin can be a little trickier. No worries, there’s a nice plugin which can help you to update your WordPress website domain name easily (though I will recommend the manual method above).

You can use “Automatic Domain Changer” plugin for this purpose. After installing this plugin you will find the option for changing domain name by navigating to “Tools” >> “Change Domain“.

automatically update wordpress site domain name

Please feel free to comment below if you have any concern, issue or suggestion.

Share this:

  • Share on X (Opens in new window) X
  • Share on Facebook (Opens in new window) Facebook
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Reddit (Opens in new window) Reddit
  • Email a link to a friend (Opens in new window) Email

Related

Previous Article Frequently Used SSH (Secure Shell) Commands for a Web Developer
Next Article How to Secure WordPress Site From Hacking, DDoS and Brute Force Attack

About the author

Md. Zubaer Ahammed
Md. Zubaer Ahammed

Md. Zubaer Ahammed is a senior full-stack developer building learning platforms and modern web systems with WordPress, Laravel, Python/Django, Vue, and React. More at https://zubaer.com/.

Related Posts

  • AI Translation Workflow for WordPress Posts: Glossary-Aware LLM Drafts with Human Review and Locale Linking AI Translation Workflow for WordPress Posts: Glossary-Aware LLM Drafts with Human Review and Locale Linking
  • AI Internal Linking Suggestions in Gutenberg: Embedding Similar Posts with Human-Approved Insert AI Internal Linking Suggestions in Gutenberg: Embedding Similar Posts with Human-Approved Insert
WP Tuts Hub

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

  • Portfolio
  • Calorie Calculator Pro
  • Contact
  • About
  • Privacy
  • Terms

© 2026 WP Tuts Hub · Md. Zubaer Ahammed

Loading Comments...