How to Change a WordPress Domain Name?

Ahsan Parwez
HostWP Expert

Last updated: October 28, 2026 |
Quick Answer

Changing a WordPress domain name involves updating both the WordPress settings and the database to reflect the new URL. The safest approach is to create a full backup first, update the URLs in Settings > General, run a search-and-replace on the database to fix internal links, and then update your DNS records.

Detailed Answer

  • Changing your domain name is one of the riskiest tasks in WordPress. A single missed URL can break your theme settings, widgets, or even lock you out of the admin panel entirely.Here is how to do it without breaking your site:
    • Create a full backup first: Before touching anything, export your database and download all your files. If something goes wrong, this backup is your only lifeline.
    • Update WordPress Settings: Go to Settings > General and change both the “WordPress Address (URL)” and “Site Address (URL)” fields to your new domain. Save changes. You will be logged out and need to log back in with the new URL.
    • Run a database search and replace: This is the most critical step. Use a plugin like Better Search Replace to safely update every instance of your old domain in the database. Never do this manually in a text editor, as it corrupts serialized data and breaks widgets, theme options, and plugin settings.
    • Update .htaccess and wp-config.php: If you have hardcoded URLs in either of these files, update them manually. Most modern setups do not require this, but it is worth checking.
    • Set up 301 redirects: Install a redirection plugin (like Redirection) and create 301 redirects from your old domain to the new one. This preserves your SEO rankings and ensures visitors land on the right page.
    • Update Google Search Console and sitemaps: Submit your new sitemap to Google and use the “Change of Address” tool in Search Console to tell Google your site has moved.

    Main factors that cause domain change issues:

    • Skipping the search and replace: Your old domain will still appear in post content, menu links, and widget settings, causing broken images and navigation errors.
    • Corrupting serialized data: Manually editing the database file turns theme options and plugin settings into unreadable gibberish.
    • Forgetting redirects: You will lose years of SEO value and confuse returning visitors who bookmarked the old domain.
    • Locked out of admin: If the database URL does not match wp-config.php, WordPress will reject your login attempts.
Ahsan's take

Changing a domain name is like renaming your house while you are still living inside it. Everything – the mail, the GPS, the delivery addresses – needs to be updated at the same time, or things will get lost. My honest advice: never do this on a live production site without testing on a staging environment first. If your host offers a staging feature (HostWP.io does), clone your site there, change the domain on the clone, test everything thoroughly, and only then push it live. And please, for the love of your SEO rankings, set up those 301 redirects. Losing your Google rankings over a missed redirect is a tragedy I have seen too many times.

 

Was this answer helpful?
Share:
Still have question?

Our WordPress expert are here to help you 24/7.

Contact Support

Expert WordPress Support Engineers Available 24/7

90 sec
Average
Response Time

98 %
Customer
Rating

24/7
Expert
Support

Black Friday · Cyber Monday

Our biggest sale of the year.
Up to 40% off WordPress hosting.

Choose the plan that fits your business. All plans include our core managed hosting features and expert human support with no hidden fees.
Expires in:
View Plans

Submit Your Question Here.