How to Change WordPress Domain Name
Changing the domain name of a WordPress website may seem like a simple task, but it involves more than just pointing a new domain to your hosting account. WordPress stores the website address in its database, and links to images, pages, scripts, and other resources may also contain the old domain.
If these settings are not updated correctly, you may encounter problems such as redirect loops, broken images, login errors, missing styles, or pages that continue to load from the old domain.
In this guide, you will learn how to safely change your WordPress domain name, update the necessary settings, replace old URLs, configure redirects, and check the website after the migration.
What Does Changing a WordPress Domain Mean?
Changing a WordPress domain means moving a website from one domain to another while keeping the existing WordPress installation and content.
For example:
Old Domain:
https://oldwebsite.com
New Domain:
https://newwebsite.com
The website’s:
- Posts
- Pages
- Images
- Themes
- Plugins
- Users
- Database
- Settings
can remain in place while the domain name changes.
However, WordPress and its database may still contain references to the old domain, so those references need to be updated.
Why Change a WordPress Domain?
There are several reasons a website owner may want to change a domain.
Common reasons include:
- Rebranding a business
- Changing the company name
- Moving to a shorter domain
- Switching from one domain extension to another
- Using a more relevant domain
- Moving from a temporary domain to a production domain
- Consolidating multiple websites
- Moving from a subdomain to a primary domain
For example, a business may initially use:
examplehosting.in
and later move to:
examplehosting.com
Important Things to Do Before Changing the Domain
A domain change can affect the entire website, so preparation is important.
1. Create a Full WordPress Backup
Before making any changes, create a backup of:
- WordPress files
- Database
- Media files
- Themes
- Plugins
- Configuration files
Make sure you know how to restore the backup before proceeding.
2. Make Sure the New Domain Is Registered
The new domain must be registered and under your control.
For example:
newdomain.com
3. Point the New Domain to Your Hosting
Configure the new domain’s DNS records according to your hosting provider.
Depending on the hosting setup, you may need to configure:
- A record
- AAAA record
- CNAME record
- Nameservers
Allow sufficient time for DNS changes to become available.
4. Add the New Domain to Your Hosting Account
If your hosting account requires domains to be added manually, add the new domain through the hosting control panel.
Make sure the new domain points to the correct WordPress document root.
Method 1: Change the Domain from WordPress Settings
If you can access the WordPress dashboard, this is one of the simplest methods.
Log in to:
https://oldwebsite.com/wp-admin/
Go to:
Settings → General
You will normally see:
- WordPress Address (URL)
- Site Address (URL)
Change both from:
https://oldwebsite.com
to:
https://newwebsite.com
Then click:
Save Changes
WordPress may log you out automatically because the website URL has changed.
You should then log in using:
https://newwebsite.com/wp-admin/
Important
Do not change the domain before ensuring that the new domain is correctly configured on your hosting server.
Otherwise, you may temporarily lose access to the website.
Method 2: Change the WordPress Domain Using wp-config.php
If you cannot access the WordPress dashboard, you can temporarily define the website URLs in wp-config.php.
Open the WordPress installation’s:
wp-config.php
Add the following lines before the line that says:
/* That's all, stop editing! Happy publishing. */
Add:
define( 'WP_HOME', 'https://newwebsite.com' );
define( 'WP_SITEURL', 'https://newwebsite.com' );
Replace newwebsite.com with your actual domain.
Save the file and visit:
https://newwebsite.com
Then try:
https://newwebsite.com/wp-admin/
Important
These constants override the corresponding database settings. They can be useful for recovery, but they are not always necessary as a permanent configuration.
Method 3: Change the Domain Using phpMyAdmin
You can also update the WordPress URLs directly in the database.
This method is useful when you cannot access the WordPress dashboard.
Step 1: Open phpMyAdmin
Log in to your hosting control panel and open:
phpMyAdmin
Step 2: Select the WordPress Database
Select the database used by your WordPress installation.
If you do not know which database WordPress uses, open:
wp-config.php
Look for:
define( 'DB_NAME', 'database_name' );
Step 3: Open the Options Table
Open the table ending with:
_options
The default WordPress table name is:
wp_options
However, your website may use a custom table prefix.
Step 4: Find the Site URL
Locate the rows with:
siteurl
home
Change their values from:
https://oldwebsite.com
to:
https://newwebsite.com
Save the changes.
You should now be able to access the website using the new domain.
Update Old Domain References Throughout the Database
Changing siteurl and home is not always enough.
Your WordPress database may contain the old domain in:
- Post content
- Image URLs
- Menu links
- Widgets
- Plugin settings
- Theme settings
- Custom fields
- Serialized data
For example:
https://oldwebsite.com/wp-content/uploads/image.jpg
may need to become:
https://newwebsite.com/wp-content/uploads/image.jpg
For larger websites, manually changing these references is not practical.
Using WP-CLI to Replace the Old Domain
WP-CLI provides a convenient method for replacing URLs throughout a WordPress database.
First, create a database backup.
Then run:
wp search-replace 'https://oldwebsite.com' 'https://newwebsite.com' --all-tables
This command searches the database for the old URL and replaces it with the new URL.
WP-CLI is particularly useful because WordPress databases can contain serialized data. A proper WordPress-aware search-and-replace operation can handle serialized values more safely than a basic text replacement.
You can preview changes before applying them with:
wp search-replace 'https://oldwebsite.com' 'https://newwebsite.com' --all-tables --dry-run
Review the output before performing the actual replacement.
Important: Do Not Use a Basic SQL Replace Everywhere
You may find SQL commands online that perform a simple string replacement across database tables.
Be careful with this approach.
WordPress plugins and themes can store serialized PHP data in the database. A basic text replacement can damage serialized data if string lengths change.
For this reason, WordPress-aware tools such as WP-CLI or a migration solution designed to handle serialized data are generally preferable for a complete domain replacement.
Update Image URLs After Changing the Domain
Images are one of the most common things to check after a domain change.
An image may still reference:
https://oldwebsite.com/wp-content/uploads/2026/09/image.jpg
instead of:
https://newwebsite.com/wp-content/uploads/2026/09/image.jpg
If your images are missing, check:
- Media Library
- Post content
- Theme settings
- Featured images
- CSS files
- Plugin settings
Also verify that the physical files still exist in:
wp-content/uploads/
Change the WordPress Permalinks
After changing the domain, review the permalink configuration.
Go to:
WordPress Dashboard → Settings → Permalinks
Review your existing permalink structure and click:
Save Changes
This can regenerate WordPress rewrite rules.
Then test several pages and posts.
For example:
https://newwebsite.com/about-us/
https://newwebsite.com/blog/
https://newwebsite.com/contact/
Set Up 301 Redirects From the Old Domain
If the old domain previously received visitors or search-engine traffic, do not simply abandon it.
Configure permanent redirects from the old domain to the corresponding URLs on the new domain.
For example:
https://oldwebsite.com/about/
should redirect to:
https://newwebsite.com/about/
A 301 redirect tells browsers and search engines that the page has permanently moved.
Whenever possible, redirect each old URL to its corresponding new URL rather than sending every page to the homepage.
Example Apache Redirect Configuration
If your server uses Apache, redirects can be configured using .htaccess or through your hosting control panel.
A simple domain-level example is:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?oldwebsite\.com$ [NC]
RewriteRule ^(.*)$ https://newwebsite.com/$1 [R=301,L]
Replace the domains with your actual domains.
Before editing .htaccess, keep a backup of the existing file. Incorrect rewrite rules can cause redirect loops or server errors.
Configure HTTPS for the New Domain
The new domain should have a valid SSL certificate.
After the domain becomes active, install or issue an SSL certificate for:
newwebsite.com
www.newwebsite.com
Then verify:
https://newwebsite.com
loads correctly.
If the website uses a CDN or reverse proxy, check the SSL configuration there as well.
Update Your WordPress Site URL Correctly
After the domain change, verify that WordPress recognizes the new address.
You can check:
Settings → General
Verify:
WordPress Address (URL)
https://newwebsite.com
and:
Site Address (URL)
https://newwebsite.com
If your website intentionally uses different WordPress and public URLs, keep those values configured according to your specific setup rather than automatically making them identical.
Update External Services
Changing a domain can affect services connected to your website.
Review and update:
- Google Analytics
- Google Search Console
- Bing Webmaster Tools
- CDN settings
- Email services
- SMTP configuration
- Payment gateways
- reCAPTCHA
- Social media profiles
- Advertising platforms
- Webhooks
- API integrations
- Third-party applications
Some services may require verification of the new domain.
Update Your WordPress Email Configuration
If your website sends email using the old domain, review your:
- WordPress administrator email
- SMTP settings
- Contact forms
- Notification addresses
- WooCommerce emails
- Domain-based email accounts
For example, you may need to change:
[email protected]
to:
[email protected]
Check WordPress Plugins and Themes
Some plugins and themes store domain-specific settings.
After changing the domain, check:
- Theme customization settings
- Page builders
- SEO plugins
- Caching plugins
- Security plugins
- Backup plugins
- Image optimization plugins
- Forms
- Membership plugins
- WooCommerce
Clear plugin and server caches after updating the domain.
Clear Website and CDN Cache
If the old domain or old URLs continue appearing, cached content may be responsible.
Clear:
- Browser cache
- WordPress cache
- Plugin cache
- Server cache
- CDN cache
Then open the website in a private/incognito browser window and test it again.
Check for Mixed Content
After moving from one domain or HTTP to HTTPS, some resources may still use an old HTTP URL.
For example:
http://newwebsite.com/image.jpg
instead of:
https://newwebsite.com/image.jpg
Mixed content can cause browsers to block some resources.
Check:
- Images
- CSS
- JavaScript
- Fonts
- Embedded content
Check Your Website for Broken Links
After changing the domain, test important pages manually.
Check:
- Navigation menus
- Internal links
- Images
- Categories
- Tags
- Blog posts
- Contact pages
- Download links
- Featured images
You can also use a website crawler or broken-link checker to identify URLs that still point to the old domain.
Change the WordPress Login URL
After the domain change, the normal WordPress login address becomes:
https://newwebsite.com/wp-admin/
or:
https://newwebsite.com/wp-login.php
If a security plugin changes the login URL, use the login path configured by that plugin.
Common Problems After Changing a WordPress Domain
1. WordPress Redirects to the Old Domain
Check:
- WordPress Address
- Site Address
wp-config.php- Database
homeandsiteurl - Cached redirects
.htaccess- CDN configuration
Also check whether a plugin is forcing the old domain.
2. WordPress Shows a Redirect Loop
A redirect loop may be caused by:
- Incorrect HTTP/HTTPS settings
- Conflicting redirects
- CDN configuration
.htaccessrules- WordPress URL mismatch
- Reverse proxy configuration
Temporarily review or disable conflicting redirect rules and verify the site’s URL configuration.
3. Images Are Not Loading
Check whether image URLs still contain the old domain.
Also verify:
wp-content/uploads/
exists and contains the required files.
4. CSS or JavaScript Is Missing
Clear caches and check whether CSS and JavaScript files are still being loaded from the old domain.
Also verify that the new domain has a valid SSL certificate.
5. WordPress Admin Is Not Accessible
If the domain was changed incorrectly, use wp-config.php or phpMyAdmin to correct the WordPress URL.
For example:
define( 'WP_HOME', 'https://newwebsite.com' );
define( 'WP_SITEURL', 'https://newwebsite.com' );
Make sure the new domain actually points to the WordPress installation before applying these settings.
6. Pages Return 404 Errors
Go to:
Settings → Permalinks
and save the permalink settings again.
If that does not solve the issue, inspect your server rewrite configuration.
WordPress Domain Change Checklist
Use this checklist before declaring the migration complete:
- Full WordPress backup created
- New domain registered
- New domain added to hosting
- DNS configured
- New domain points to the correct server
- SSL certificate installed
- WordPress URL updated
- Site URL updated
- Old URLs replaced where necessary
- Images tested
- Permalinks refreshed
- 301 redirects configured
- Caches cleared
- Forms tested
- Email tested
- Plugins checked
- Themes checked
- Analytics updated
- Search Console updated
- CDN configuration checked
- Broken links checked
- Old domain retained for redirects
Frequently Asked Questions
Can I change my WordPress domain without reinstalling WordPress?
Yes. In many cases, you can change the domain without reinstalling WordPress. You need to update the site’s URL configuration, database references, DNS, SSL, and redirects as required.
Will changing the domain delete my WordPress content?
Changing the domain itself does not normally delete your posts, pages, users, or media. However, incorrect database or file operations can cause data loss, which is why a complete backup should be created first.
Do I need to change the WordPress database?
You may need to update database values containing the old domain. Changing only the home and siteurl values may not update URLs stored elsewhere in the database.
Do I need to keep my old domain?
If the old domain has existing visitors, backlinks, indexed URLs, or other references, keeping control of it can be important so you can maintain redirects to the new domain.
How long should I keep redirects from the old domain?
There is no universal period that applies to every website. For a domain migration, keeping the old domain and its redirects for an extended period helps visitors and external links continue reaching the new site.
Can I change from HTTP to HTTPS at the same time?
Yes, but it introduces another URL change. Make sure the SSL certificate is working correctly and update internal URLs and redirects carefully.
Can I change from .in to .com?
Yes. The process is similar to any other WordPress domain change. Configure the new domain, update WordPress URLs, replace necessary database references, install SSL, and configure redirects from the old domain.
Final Thoughts
Changing a WordPress domain name is a manageable process when it is planned carefully. The most important steps are creating a complete backup, configuring the new domain correctly, updating WordPress’s URL settings, replacing old domain references safely, installing SSL, and creating appropriate redirects from the old domain.
After the change, thoroughly test your website rather than checking only the homepage. Pay particular attention to images, internal links, forms, plugins, login access, email, HTTPS, and important business functionality.
A carefully planned domain migration can preserve your existing website structure while giving your business a new web address with minimal disruption.