It’s time to migrate your website to a new URL. Congrats on your new venture!
Before we begin, just know that the thought of migrating your site over to a new URL may seem overwhelming, but if you take it step-by-step, you’ll be okay. We got you.
Before you do anything at all, you NEED to back up your site.
Do not let that little voice inside of you say, “Eh…it will be okay.” No, no it won’t. If you don’t do something right, you could lose your entire site. Yes, all of the content and hard work you put into the design will be gone.
You have two options to back up your site. You can either copy all of the files from your FTP program or you can use a plugin. If you do it manually, remember that the .htaccess file is hidden, so you have to uncover it to copy it.
Just do yourself a favor and use a plugin to ensure you get it all.
Exporting the Database
Sign into your cPanel for your server and go to your phpMyAdmin.
Select the database for the WordPress site you want to migrate, and then click on Export.
You can choose the quick export option and the SQL format.
After it goes through the export process, the file will download to your computer.
You now have all of the contents of your old WordPress site. You are ready to move it over to your new one.
Installing the WordPress Database
Unfortunately, you can’t just upload the file to the new host server. You need prepare it first by creating a database.
Login to your new web host’s cPanel.
Look for MySQL Database and open it.
Create a new database and give it a name (usually the name of your site).
You will need to create a new user for MySQL.
Add this new user to your database and give it all privileges.
Be sure you take down all of the information from the MySQL database, such as the name of the database, username, and password.
Editing the Config File
Find the wp-config.php file in the files you downloaded to your computer.
Copy it to your computer.
Go to the file in its original location, and find the line: define( ‘DB_NAME’, ‘db_name’);.
Make the following changes:
Replace the lower case db_name of the line to your database’s name (the new one you created).
The next line, you will see: define( ‘DB_USER’, ‘db_user’);
The lower case db_user should be the new username you created.
The next line, you will see: define( ‘DB_PASSWORD’, ‘db_pass’_;
You probably know what you need to replace the ‘db_pass’ with, right? Yes, the password you created.
Save the edited wp-config.php file and close it.
By the way, the wp-config.php you copied earlier? It was just a backup. Keep it handy in case something goes wonky after you upload this edited one.
Time to Import
Go to your phpMyAdmin on your new host server (you can find it by logging into the cPanel).
You should see Import. Click “Choose File” and then find your SQL file.
Unclick the option for “Partial Import.” We want it all.
Make sure you also set the format to SQL.
How long it will take to import the SQL file depends on the size of your site. You’ll receive a notification when it’s done.
Upload Your WordPress Site
Now, we upload the files for your site. Go to your FTP program and click the folder where your files will live. If this is the only site on your new web host, you can use public_html.
All you need to do is upload all of the WordPress folders and files to that directory. It can take some time, so grab yourself a coffee or something as it does its thing.
Many people forget this step and it’s an important one. You likely have internal links throughout your site. Since you have new URL, those internal links will be broken now. You could just go through all of them, but that could take forever. Our suggestion is to use Search Replace DB. It’s incredibly easy to use, and you won’t miss any links.
You’re all set! If you follow these steps, your site will be migrated successfully.