Before changing your WordPress domain, it’s essential to approach the process with caution and attention to detail. Moving your website to a new domain can seem like a daunting task, but with the right steps, you can make the transition smooth and successful. In this guide, we’ll walk you through the necessary preparations and the steps to safely change your WordPress domain while minimizing risks such as broken links, loss of SEO rankings, and other potential issues. Whether you’re rebranding, upgrading your domain, or switching hosting providers, this process will ensure that your website continues to function seamlessly after the switch. Let’s dive into the key steps for changing your WordPress domain.
Table Of Contents
- 1 Disable Any Redirection Plugin or WordPress Security Plugin or WordPress Login URL Change Plugin for Collision Prevention
- 2 Clear the Cache and Disable Cache Plugins
- 3 Backup Your Website, Buy a New Domain, and Have the Old Domain and New Domain at the Same Time
- 4 Point Your Hosting to Your New Domain
- 5 Reset .htaccess to WordPress Default to Prevent Collisions
- 6 Change wp_options Table Value of “home” and “siteurl” to New URL
- 7 Add WP_HOME and WP_SITEURL to wp-config.php
- 8 Open Your Website in New Domain and Go to Admin Dashboard
- 9 Install Better Search Replace Plugin and Replace Old Domain
- 10 Reset your SEO plugins Settings
- 11 Change Your URL to New Domain in Google Search Console
- 12 Ta-Daaa! Done
Disable Any Redirection Plugin or WordPress Security Plugin or WordPress Login URL Change Plugin for Collision Prevention
Before proceeding with a domain change, it is crucial to ensure that no plugins conflict with the process. Conflicts can cause redirection loops or prevent your site from loading correctly. Follow these steps:
- Log in to your WordPress dashboard.
- Go to Plugins > Installed Plugins.
- Look for any plugins that handle redirection, Change WordPress login URL, or enforce security-related URL changes or WordPress Security Plugins.
- Deactivate these plugins temporarily. Examples include plugins like Redirection, iThemes Security, or WPS Hide Login.
Once the domain change is complete, you can re-enable these plugins after testing their compatibility with the new domain.
Clear the Cache and Disable Cache Plugins
Clearing the cache and disabling cache plugins is an important step after changing your WordPress domain. Cache plugins store static versions of your website to improve load times, but they can cause issues by serving outdated content. By clearing the cache and disabling any active cache plugins (WP ROCKET, LITESPEED and etc ), you ensure that your site visitors always see the most current version of your website, reflecting the changes you’ve made. Make sure to disable the cache plugins temporarily to avoid conflicts and enable proper redirection and URL updates.
Backup Your Website, Buy a New Domain, and Have the Old Domain and New Domain at the Same Time
Changing your domain is a significant step, and a full backup ensures you can restore your website if something goes wrong. Here’s what you need to do:
- Backup Your Website:
- Use a plugin like UpdraftPlus, All-in-One WP Migration, or BackupBuddy to create a complete backup of your website.
- Include both files and the database in your backup.
- Store the backup on a secure location like your local computer or a cloud storage service (e.g., Google Drive, Dropbox).
- Buy a New Domain:
- Purchase your new domain from a trusted registrar such as Namecheap, GoDaddy, or Google Domains.
- Ensure the new domain is unique and relevant to your brand.
- Keep Both Domains Active:
- During the transition, both the old and new domains should be functional to avoid downtime or broken links.
- This ensures that users accessing the old domain are redirected properly once the migration is complete.
Point Your Hosting to Your New Domain
- Update DNS Records:
- Access the DNS management settings of your new domain and point your Domain Records to your Website Hosting recommended record name (you can ask your hosting provider for these values ) .
- Add the New Domain to Your Hosting:
- Log in to your hosting control panel (e.g., cPanel, Plesk, or a custom dashboard).
- Add the new domain under the “Domains” section, or update the primary domain if applicable.
- Wait for Propagation:
- DNS changes may take 24-48 hours to propagate worldwide, although it often happens much faster (com domain usually take 10 minutes to change, domestic domains may take 24-48 hours ).
Reset .htaccess to WordPress Default to Prevent Collisions
The .htaccess
file controls many aspects of how your site behaves, including redirections. Resetting it ensures a clean slate. Here’s how:
- Access your site’s root directory via FTP or a file manager in your hosting panel.
- Locate the
.htaccess
file. If you can’t see it, enable the option to view hidden files. - Replace the existing content with the default WordPress
.htaccess
code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
- Save the file and upload it back to the server if necessary.
Change wp_options
Table Value of “home” and “siteurl” to New URL
The wp_options
table in your database stores critical site information, including the domain. To update it:
- Log in to your hosting control panel and open phpMyAdmin.
- Select your WordPress database.
- Locate the
wp_options
table (or a similarly named table if you changed the prefix). - Edit the
home
andsiteurl
rows:- Replace the old domain with the new domain (e.g.,if you have ssl on your website replace
https://olddomain.com
withhttps://newdomain.com
or for non https websiteshttp://olddomain.com
withhttp://newdomain.com
).
- Replace the old domain with the new domain (e.g.,if you have ssl on your website replace
- Save the changes.
Add WP_HOME and WP_SITEURL to wp-config.php
Adding the domain information to the wp-config.php
file provides an additional layer of consistency. Follow these steps:
- Access your site’s root directory using an FTP client or file manager.
- Open the
wp-config.php
file for editing. - Add or Update the following lines, replacing
https://newdomain.com
with your new domain
if you have ssl on your website add
define('WP_HOME','https://newdomain.com');
define('WP_SITEURL','https://newdomain.com');
if you dont have ssl on your website add :
define('WP_HOME','http://newdomain.com');
define('WP_SITEURL','http://newdomain.com');
- Save the file and upload it back to the server if necessary.
Open Your Website in New Domain and Go to Admin Dashboard
Once the above steps are completed, visit your website using the new domain. Log in to the WordPress admin dashboard by navigating to http://newdomain.com/wp-admin
. to do further changes to continue “Change WordPress Domain” Process.
Install Better Search Replace Plugin and Replace Old Domain
To ensure all references to the old domain are replaced, use the Better Search Replace plugin:
- Go to Plugins > Add New in your WordPress dashboard.
- Search for “Better Search Replace” and install it.
- Go to Tools > Better Search Replace.
- Enter your old domain (e.g.,
olddomain.com
) in the “Search for” field. - Enter your new domain (e.g.,
newdomain.com
) in the “Replace with” field. - Select all tables to search and replace.
- Check “case insensitive” and “Replace GUID”
- Uncheck “Run as Dry” to apply the changes.
- Run the search and replace operation.
Reset your SEO plugins Settings
Open your SEO plugin settings and reset the values to ensure they align with your new website’s SEO structure and guidelines.
Change Your URL to New Domain in Google Search Console
Ta-Daaa! Done
Your WordPress domain change is now complete and you Changed WordPress Domain Successfully. Thoroughly test your website to ensure:
- All links work correctly.
- Images and media load without issues.
- Plugins and themes function as expected.
If you encounter any issues, review each step to ensure everything was configured correctly. Enjoy your website on its new domain!