It is so Easy to change old domain with new domain in wordpress site. we have so much question about changing Old domain names of WordPress sites to New Domain. here you can find step by step guide for How to change WordPress site address (URL).
There are many ways to switch to your site to another new domain. The most probable used and easiest method you can find below
How to Change the Domain of Your WordPress Site
Before proceeding with the migration steps, you should have –
- Access to your cPanel & FTP
- A new Domain
- Backup everything
When you are done with a complete backup. Proceed to the next step.
1. Adding New Domain to Your Hosting Account
To use the new domain, you need to add it to your hosting. You can easily Add you domain from cPanel. Just click on the Addon Domain Option.
Now, enter your new domain address, subdomain, and document root. Click Add Domain.
2. Now Copy the Old Domain Folder to the New One
Download your backup file or you can directly copy your previous folder to the new domain folder. This process is easier if you are not switching your hosting. If you are migrating to a new hosting as well, you will need to download your backup and add it to your FTP. You can do all these with cPanel easily.
3. Now Change the Site URL in wp-config.php
Now, open your new domain folder. Edit the wp-config.php file and define site URL and site home page for your new domain. You can use the following code.
You must replace newdomain.com with your new domain name.
4. Now Updating Database Info (Not Necessery)
In this tutorial, we are migrating the domain name only, not changing the hosting. Thus, there is no need to change the database. If you need to change the database, you will need to update the database info inside the wp-config file of your WP installation.
Log in to your cPanel and click on the File Manager.
Navigate to your WordPress installation folder and find the wp-config.php file. Right click on it and click Edit.
You will find an editing interface. Look database base name and replace the old one with the new one that you have created (if required).
5. Install Search and Replace Plugin
Now, login to your new domain WordPress Admin Dashboard. You will need to install Search and Replace Plugin. It will help you to search and replace anything you want within your WordPress. Simple, replace the new domain with old domain. Now, Search and Replace new domain with old domain.
6. Clean Cache and Refresh Browser
Cleaning cache can solve many unwanted issues. So, clean your cache and refresh your browser. Now, visit your new domain homepage.
7. Redirect Old Domain to New Domain
In this stage, you will require to setup a permanent 301 redirect to your website. This will help with both user experience and SEO of your site. Your users, who will land to your website from search engine, will be redirected to your new domain.
To set up permanent 301 redirect, log in to your cPanel and click on the file manager and open your websites folder. Now, find the .htaccess file and click on edit.
Now, add the following code to the top of your .htaccess file.
RewriteRule ^(.*)$ http://www.newsite.COM/$1 [R=301,L]
You must replace newsite.com with your newly added domain name.
If you haven’t put the code in wp-config file to change site addresss or domain name, you can follow this process. Log in to your WordPress Admin Dashboard and navigate to Settings → General.
Under general settings, you will find two fields named WordPress Address URL and Site Address (URL). You will notice it has your present domain included.
Change the old domain name with the new one. For example, if your new domain is ‘newdomain.com‘ and the old one is ‘olddomain.com‘. Replace the old one and Save changes.
Now, you have successfully migrated or changed your old domain name with a new one. The only thing left to do is to notify about the changes you made.
You should notify search engines such as Google. To do so, visit Google Webmaster Tools and login to your account and click on the Change of Address under Configuration. There is an option ‘Tell us the URL of your new domain’. Just add your new site URL and verify. You should also let your users know about the change to avoid confusion.
So, what do you think? Isn’t it easy to change the domain name of a WordPress site?
If you know any other process, please comment below and let us know.