A few months ago, I transferred my domain name from MyBlogLift.com to BlogCharge.com. I must agree, it was a tough decision for me but I took the hard call and went for it.
Although it turned out to be a bad decision later (domain was spammed), I’m happy that I actually made the change.
The new domain is shorter, gives a clear idea of my blog, and best of all I achieved it with 100% uptime. If the there wasn’t an issue with the domain, I’m pretty sure the change wouldn’t have improved the SERP rankings as well.
In this post, I’m sharing exact steps I took to transfer my WordPress site to a new domain with 100% uptime.
I didn’t change the host and used the same hosting account. But the steps mentioned here will work exactly the same as long as your host comes with a CPanel (most shared web host do)
Before we begin, let’s make sure that you actually want this change.
Table of Contents
Why Change Domain Name?
There are tons of reasons why one would like to change the domain name of their existing site, but these are the most common:
- Brand upgrade: If you’ve found a better domain name which represents your business well and can secure your future brand, it’s a no-brainer that you’d actually want to make the change ASAP.
- To get rid of penalty: Does Google penalized your domain because you were using some shady techniques? There are very little chances that you can get rid of penalty and rank your domain again. It’s easier to just move to a new domain name.
- You got your hands on a high DA domain: Accept it or not, DA is an important factor and domains with higher DA can give your rankings an edge over your competitors. If you bought an expired or auctioned domain with good metrics, move!
- Your current domain got a copyright infringement: Unknowingly, we sometimes buy a domain name which somehow breaks the law. Your domain name may get a copyright infringement leaving you with no other option than deleting it and moving forward.
There could be more reasons, but these are the most common I’ve seen. If you’re transferring your domain for a silly reason, then please stop.
You don’t need to take the unnecessary risk and affect rankings of your site. Take this decision only when it’s important and helpful for your site’s future.
So, now let’s start the tutorial.
Step 0: Getting Ready
Although I’m trying to make this guide as easy as possible, I haven’t tested every host and database. Things could go south and you might lose all your hard work in a splash.
Due to this sole reason, I suggest taking proper backup of everything while your site runs fine. You can take the backup manually or use a plugin (recommended)
If anything goes unexpected, you can easily revert back and it’ll give you a peace of mind while taking actions.
How To Take WordPress Backup
As suggested, I recommend using a plugin to take WordPress backup. Doing it manually is also fine but there’s a risk that you may fail to backup certain important files breaking your site.
There are several free plugins available in WordPress repository but one I’ve been using and gets the job done is UpdraftPlus.
It’s a free plugin and it allows you to backup your site both easily and automatically. To install it, log in to your WordPress dashboard and go to Plugin > Add New
Search for “UpdraftPlus” – install and activate it.
After activation, you can either download the Backup file and store it on your computer or choose to directly save it to the cloud.
Alternatively, if you’re hosting with good WordPress hosts like InterServer or Cloudways, you don’t have to worry about site backup.
Reduce the Size
During the entire process, we will be downloading and uploading the backup file. It’s a good thing if you can reduce its size which will help you speed up the process.
There are certain unnecessary files clogging up storage which can be removed without affecting any functions of the site.
Some of these are:
- Post Revisions: Post revisions are automatically generated by WordPress as you make changes to the post/pages. Use a plugin like ”Simple Revisions Delete” to delete the unwanted post revisions.
- Backup Files: If you’ve already downloaded the backup file generated earlier, it makes no sense to keep it on your server. Delete it to free up data.
- Non-Active Plugins: If there are plugins which you aren’t using and they are just lying around, you can delete them. It’s also good for your site security as hackers may exploit your blog using these inactive or outdated plugins (source)
- Database: There are some redundant files in the database that eat up your storage. Use plugins like “Autoptimize” to optimize your WordPress site.
- Comments: Delete the unapproved and comments under the spam tab.
- Themes: If there are inactive themes installed and you don’t plan to switch to any of them, consider removing them from the site.
Optimizing the above files can reduce the size by a few MBs which will help later in the operation.
Note: You can perform this step even before creating a backup. I do it after as I don’t have to worry about deleting some important files while optimizing. I have a backup file and I can revert to it in unexpected cases.
Now that you have got a proper backup stored in a safe place and an optimized site, we’re ready to take the action.
Step 1: Move WordPress from One Domain to Another
There are two methods you can use to change the domain of existing WP site:
- Using a plugin
- Doing it manually
Using a plugin takes out all the tech part involved, but I’ve found it to be slow unless you’re ready to pay for a premium plugin.
Doing things manually gives you a better control over the process but you need to have some technical knowledge and familiar with FTP or CPanel file manager.
Let’s discuss both.
Method One – Use A Plugin
There are tons of plugins available to help you change your domain name, but for the sake of this tutorial, I’m going to use “All-in-One WP Migration”
It’s available for free in WordPress repository but with limited features – you can only download the backup file offline with a limit of 512 MB. The same applies to upload.
If you’re planning to use this plugin for the said purpose, make sure:
- You have bought the new domain name
- Own hosting (new or current)
- You’ve installed WordPress on a new host
- And you’re properly set up the nameservers for the new domain (without which you won’t be able to login to WP Dashboard)
In case you need help installing WordPress, refer to this guide. Although it’s for SiteGround, it’ll work flawlessly on other hosts as well.
Everything checked? Let’s get started.
1. Install “All-in-One WP Migration” plugin on your current WordPress site. Go to ‘Plugins > Add new’ from the left side menu.
2. Search for ‘All in one WP Migration’ and click ‘Install’. After installation, Activate it and you’ll get a new option in left side menu panel.
3. Find the new option called “All in One WP Migration” and select “Export”
4. On the next page, click on ‘Export To’ button and then choose ‘File’ (You can’t choose other options as it requires a paid extension)
5. Clicking on the site will start the backup process and it could take several minutes depending on the size.
6. Once the process is complete, you’ll get an option to download the backup. Since I’m doing this tutorial on a test site, my file size was just 31 MB
7. Download the file and save it to the desktop (Easier to access) The file will be downloaded with a .wpress extension. Do not alter it as it can break the migration process.
8. Now repeat steps 1-2-3 on your new WordPress site.
Note: Make sure you don’t have any important data on this site as while exporting backup, it will be deleted and replaced.
9. On your new site, go to “All in WP Migration” and select “Import”
10. Now click on ‘Import’ button and select ‘File’. Choose the backup file you saved on the Desktop (or another directory)
Alternatively, you can drag and drop the .wpress file directly.
11. The upload process is really slow and depends mainly on your internet speed and web host. It may take anywhere from several minutes to hours (I’m serious!)
In some cases, it won’t even start. In that case, click on ‘Stop Import’ button, refresh your site and start uploading again.
12. After a successful upload, you’ll get a warning popup asking you to confirm the action. Click on Continue.
13. The upload is now successful and your site has been moved. But there’s one important left – save your permalink structure TWICE.
14. When you click on the ‘Permalink Setting’, you’ll be logged out of the WP site. Login with your new site credentials and go to “Settings > Permalinks”
15. Confirm that it’s same as the old one and click on save. After a refresh, save it again.
Your site is ready and now you can visit it to see if there are any visible issues. Browse different pages and make sure you don’t face any conflicts.
Bonus
For those who have got a larger size file than 512MB and can’t seem to use this plugin, watch the below video.
It’ll teach you a little trick to bypass the limit by changing few lines of code (actually one!)
Although I and the creator of video do not recommend the method, it’s helpful if you want to migrate just one site.
Update: The video was taken down by YouTube.
I’m pretty sure first method will get the job done but know that there’s another way as well. It’s good if you want to speed up the process.
Method Two – Doing it Manually
To move WordPress site from one site to another manually, you need to have access to following:
- Your new domain name
- A new host or current host
- CPanel access
- Domain’s nameserver pointing to the host
You don’t need to install WordPress on your new domain. If you’ve already done it, you need to delete it first before moving.
Make sure that the directory is empty and nothing will be lost while moving previous site’s data.
Let’s dive in…
1. The very first thing we need to do is, backup the complete data of existing site and download it. For this, log in to your CPanel account and click on ‘File Manager’
2. Now locate the folder where your existing site is installed. In most cases, you’ll find it under ‘public_html’ folder. Your site may be installed directly in ‘public_html’ or within a sub-folder (name of your site)
3. Once you’ve found it, click on ‘select all’ option on the top and then click on ‘Compress’
4. Choose the zip option from the popup and click on “Compress File(s)” button. Scroll down to change the name of the backup file. It’ll create a compressed file and save it in the same folder.
Download the compressed file and save it anywhere on your local PC.
5. We now have a backup of all the content of the site. Up next, we need to make a copy of the database.
For this, go back to CPanel dashboard and scroll down to find ‘Database’ column. Under it, there will be ‘phpMyAdmin’ option. Click on it to view your databases and its contents.
6. If you’re hosting only your existing site on the hosting, there’ll be one single database. Otherwise, there will be multiple databases with random names. You want to make sure that you only export the appropriate database.
To know what database you need to export, go back to your site’s folder (in File Manager) and open the wp-config.php file.
Look for the line:
define('DB_NAME', 'wpphd_wp944');
Here the ‘wpphd_wp944’ is the name of the database that you want to export.
Go back to phpMyAdmin window and then choose the right database.
7. Now click on the ‘export’ option from the top-most menu.
8. Leave everything as it is and click on ‘Go’ button. It’ll start downloading a .sql file. Save it to the same folder where you saved the compressed backup.
9. Everything has been backed up, it’s time to move the site to a new domain.
Note: Make sure that you’ve added the domain name to the new host’s CPanel. It’ll create an empty folder where we’ll be uploading the files.
10. Go to the new host’s CPanel or the existing one (in case you aren’t changing host but the domain)
Open ‘File Manager’ and go to ‘public_html’ folder.
11. Here you’ll find a new folder (with the name of your addon domain). Open the folder and you’ll see that there’s nothing except an index.html file. Feel free to delete it.
12. Now while in you’re inside the correct folder, click on ‘upload’ button from the top menu. Choose the .zip backup file we downloaded earlier, and upload it.
13. Once uploaded, refresh the page and you’ll see your backup file. Select it and then choose ‘extract’ button. Confirm the extract location and click on ‘Extract File(s)’ button to continue.
14. Hit refresh and you’ll see that everything has been extracted to the same folder. Delete the backup file (as it no more necessary)
15. The content has been restored but it won’t work as we haven’t yet connected the database.
To do this, go back to CPanel dashboard, look for “MySQL Databases” option under Database column. Open it, and you’ll see an option to create a new database.
16. Give a name to your database (anything you prefer) and click on create.
The database has been created and now we need to create a new user (owner of the database)
17. Scroll down to the page and you’ll find ‘MySQL Users‘ option. Give a username and a strong password to create the user.
Important: Create an empty notepad file and save the database name, username, and password in it. We’ll need the details in later steps.
Now that user and database are ready, we need to link them together.
18. On the same page, scroll down and look for a column which says ‘Add User to The Database’
Choose the correct database and user and click on ‘Add’ button. It’ll ask you for permissions, select ‘All Privileges’ and click on the ‘Make Changes’ button.
19. Now, we need to upload the .sql file. Go to CPanel > phpMyAdmin > Database on your new host.
Chose the ‘import’ option and browse to the downloaded .sql file. Without changing anything, hit the import button. Your database files will be exported.
20. Next, we need to link the content of the site with the database. Go to file manager > your site folder > edit wp-config.php file.
Look for below lines and make the changes as outlined.
/** The name of the database for WordPress */ define('DB_NAME', 'database_name'); /** MySQL database username */ define('DB_USER', 'user_name'); /** MySQL database password */ define('DB_PASSWORD', 'password');
Here the database_name, user_name, and password are the values I asked you to save earlier.
21. You may also need to change the database prefix if they’re different. For this go to the phpMyAdmin > Database
Check what is the table prefix and match it with below line in wp-config.php
$table_prefix = 'wpdh_';
In our case it’s same, so I’m not changing anything.
22. Everything is linked and your existing site has been successfully moved. Now, all we need is to change the domain name.
In your database look for a table named ‘wpdh_options’ (wpdh is a prefix and may vary)
Here you’ll find that there are URL of your existing site in two places. first at ‘siteurl’ and another at ‘home’. Change these to your new website URL.
Additionally, you can change blog name, description, and admin email from here or do it later from your WP dashboard.
You can now see your site live with the new domain.
23. Browse to newdomain.com/wp-login.php. Use the existing credentials you used to log in with and go to Settings > Permalinks from your dashboard.
Confirm the permalink structure and save it twice for changes to take effect.
Step 3: Redirect Your Old Domain to New Domain
Now that your site’s content has been moved and everything’s working as expected, it’s time to redirect your old domain name to the new one, and let the world know about your change.
For this, we need to change few lines in the .htaccess file of your previous site.
By default this file will be hidden, so we need to first change the setting.
1. Go to File Manager > Settings (at the top right corner of the screen)
2. Tick on the option ‘Show Hidden Files’ and save.
3. Now browse to ‘public_html > your site‘ folder. Find the .htaccess file and click edit.
4. Add the below lines at the start of the .htaccess file and save it.
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR] RewriteCond %{HTTP_HOST} ^www.olddomain.com$ RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L] </IfModule>
Change the olddomain.com and newdomain.com values in the above code.
Your old domain will now start redirecting all the traffic to the new domain name. Now is the perfect time to let Google know about the change (for the sake of SERP rankings)
Step 4: Inform Google
If you ignore this step and start adding contents to your new site, Google may penalize you for duplicate content.
Also, your previous site will lose all its current rankings.
To tackle these issues, let the Google know that you changed the domain of your site and it should now replace your current SERP pages with the new one.
For this, we’ll use Google’s “Change of Address” tool.
How to Use Google’s Change of Address Tool
#1 – Add your new domain to search console
Go to Google Search Console, log in with your Google account, and click on ‘Add Property’ button situated at the top.
Enter the URL of your new domain. Verify the ownership of the domain using any of the methods you prefer.
Once it’s verified, you can request a change of address from the old domain.
#2 – Request ‘Change of Address’
Go to the search console homepage and click on your previous domain name. Once there, click on ‘gear’ icon on the top right corner.
Choose “Change of Address”
#3 – Complete the steps
It’s a 4-step process, as outlined –
The steps are self-explanatory, so I’m not going into much detail. You shouldn’t face any issues.
Note: It may take anywhere from two weeks to 3 months for Google to completely crawl your website and change the SERP results. There’ll be minimal effect on your site rankings, but they’ll get stable after the process is completed.
Also, make sure that 301 redirect stays live i.e. you do not delete your old website data.
Common Problems You May Face and Their Fixes
Although I suppose you won’t face any issues if you’ve followed this guide properly, there are some exceptions.
Below are some common problems you may face during or after making the switch.
#1 – Pages aren’t loading
It commonly happens when there’s an issue with permalink structure. Try to save permalink setting again and if that doesn’t work, do the following:
- Edit the post/page
- Save it as draft
- Now publish it
It’ll hopefully solve the issue if not feel free to comment down and I’ll look for a better solution.
#2 – Errors while creating the backup or uploading it
Creating or uploading the backup are resource sensitive tasks and your server may not be able to handle it. It commonly occurs due to low PHP memory limit.
To avoid this issue, just add the below line to your wp-config.php file:
define( 'WP_MEMORY_LIMIT', '256M' );
Save the file and your PHP memory limit will be increased to 256M. You can give any other value if required.
Note: Some hosts block this action. In such case, you need to contact the host and ask them to increase the limit.
#3 – New domain isn’t indexing
This is a problem I’ve previously faced myself and it is due to the penalty or spam on the new domain name. While registering you may have overlooked it but the domain you bought has its own history.
If Google has previously penalized your domain name, it won’t index it. To check for any penalty, go to Google Search Console > Manual Actions
Here you’ll see if there are any active penalties for your domain name. You can hopefully get rid of it as I did by using these methods.
There could be more issues you might face, a quick Google search will hopefully help you solve it. You can comment below if you can’t solve the issue, I’ll try my best to help you out.
Final Words
Fewh!
It was a long read but I hope it was worth your time.
Changing a domain name can be a hectic task and there are good chances that you’ll break things if you aren’t following a proper guide. This guide to move WordPress to a new domain would help you migrate without breaking things.
Do share your thoughts about the article or topic. And don’t forget to share this post with your friends and followers.
What about the internal links? How to deal with them after domain change. Broken Link Checker is an option but not feasible for big sites. Give some better method to change all the internal links at once.
Hi Abhishek, that’s a good question. You can use plugins like “better search and replace” or “Velvet Blues Update URLs” to change the old domain to the new domain within the posts.
Hey Shafi,
I am new to blogging, I want to migrate my website to a new domain and I am afraid if I have done any mistake maybe I lost it. I have tried all in one migration plugin but it didn’t work for me.
I have no knowledge of doing it manually and the process you explained is too difficult for me. can you help me in this? I need your help to do this.
Hi Suleman,
The process is pretty simple and I’ve written a step-by-step guide with screenshots. Give it a shot and if you face any problem then contact me at shafi[at]blogcharge.com
I’ll help you with migration.
Hey Shafi,
Wonderful suggestion to migrate a site from one domain to another. WordPress is very intuitive CMS and plethora of plugins and themes help you to manage your blog and also help you to transfer or migrate your website with ease. This is one of the best reason that WordPress is a first choice for blogger. Thanks again for this great tutorial.
Have a great day 🙂
Vishwajeet
Hey Vishwajeet, thanks for sharing your thoughts. Keep visiting.
This is why we love WordPress. It is so easy to fix things in WordPress. Many thanks for sharing this useful guide here.
Hi Santanu, being user-friendly and availability of plugins for almost every task imaginable is a huge + point for WordPress. It helps non-techies start and manage their blog like a pro.
Glad that you found it helpful. Keep visiting!
Hey Shafi,
First of all your website’s new look is amazing. I always like tutorials based on personal experiences and this is one of them.
This guide you have shared is very brief and helpful for bloggers looking to switch to a new domain.
Having a guide like this will help them do the migration process smoothly without any errors.
Thanks for the share.
Regards
Alok Rana
Hi Alok,
I agree with you that sharing personal experiences can help many and you can always follow along. Glad you liked my site’s design.
Keep visiting.
Good Post
Very HelpFull Articale
Thanks For Shareing
Happy to help 🙂
Thanks for sharing this is very useful and important
You’re welcome Aadil.