If you want to move your WordPress site to a new domain name, you can do it manually by following the steps in this guide. However, most of one.com's hosting plans include our 1-click migration tool that makes the process much easier and faster.
- Step 1 - Create backups of your webspace and database
- Step 2 - Upload files to your new domain
- Step 3 - Import your database
- Step 4 - Handling database reference errors
- Step 5 - Edit the siteurl and home options
- Step 6 - Update connection details in wp-config
- Step 7 - Check your site on your new domain
- Step 8 - Update permalinks (Optional)
- Step 9 - Fix broken images with Better Search Replace (Optional)
- Step 10 - Recheck your site (Optional)
Tip: Before you begin the migration process, ensure your current WordPress website is working correctly.
Step 1 - Create backups of your webspace and database
First, you need to create a backup of your website, both your webspace files and your database.
- Webspace: Download your website's files to your computer and save a copy of the files in a separate folder on your computer to keep as a backup. Check out one of our guides if you would like some help with this:
- Database: Export your database with phpMyAdmin and save a copy of the exported SQL file in a separate folder on your computer as a backup. Refer to our guide if you need assistance:
Step 2 - Upload files to your new domain
Log in via SFTP and upload your backup to the web space of your new domain. If you made your backup with File Manager, remember to unzip it before uploading.
Step 3 - Import your database
Import the backup of your database to phpMyAdmin. Check out our guide on how to import a database if you would like some help.
Step 4 - Handling database reference errors
Between steps 3 and 4, an error message may appear depending on the database or phpMyAdmin settings where the original dump was created. If no error appears, proceed to step 5. This error message typically indicates that the SQL dump being imported contains references to either the old database name or the old database username, and these references need to be updated.
If you encounter this error message, follow these steps to resolve it:
- Open the SQL dump file with a text editor. Make sure to use a plain text editor like Notepad or gedit or a code editor like Visual Studio Code. Do NOT use rich text editors like MS Word because they can cause formatting issues and damage the file beyond repair, requiring a new SQL dump.
- Carefully search for and replace any instances of the old database name or old database username with the new and correct values.
Tip: You can quickly find a specific database name or username by using the keyboard shortcut "Control+F" on a PC or "Command+F" on a Mac to search for them.
- Save the modified SQL dump file.
- Now try to import the updated SQL dump file again by repeating step 3 as described before.
- If you still receive an error message, please contact our support team for assistance. If no error message appears, you can proceed to step 5.
Step 5 - Edit the siteurl and home options
Once your database has been imported, locate the table that ends on _options in the menu to the left and open it. Next, you need to change the location of your site in two places in the database.
- In this table that ends on _options, locate siteurl and home under the column option_name. Usually, these records are at the top of the table on lines 1 and 2.
- Start with siteurl and click Edit on the far left of this line, next to the pencil icon.
- This will open a window where you can see the field option_value.
Replace the old domain with your new domain name and click Go on the bottom right to save changes.
- Repeat the same steps for home.
Step 6 - Update connection details in wp-config
You now need to replace the login details from your old domain with those of your new domain in WordPress.
We have created a guide on how to update the connection details in case you need some help.
Step 7 - Check your site on your new domain
Take your old site offline to ensure it doesn't interfere with your new site. You can do this by renaming the index.php file on the old server. Follow these steps:
- Access the File Manager of your old domain. This will open on a new screen.
- Select the index.php file by checking the check box in front of the file.
- Choose Rename next to the pencil icon in the top right pane.
- Enter the new name, for example, index-1.php or index-old.php.
- Please don't use spaces, and remember that the file extension .php is already prefilled.
- Press Enter on your keyboard to save the file.
After opening your new domain in your browser, check if everything is working correctly. However, manual fixes may still be required.
Step 8 - Update permalinks (Optional)
In order to prevent 404 errors on your WordPress site, the .htaccess file needs to be updated. To achieve this, you have to update your permalinks.
- Log in to your WP Admin.
- Click Settings > Permalinks in the menu on the left.
- Scroll down to the Save Changes button and click on it to ensure that all subpages of your WordPress site will work without any issues.
Step 9 - Fix broken images with Better Search Replace (Optional)
If you experience that images don't show correctly, the links still refer to the old domain. You can fix this by reinserting images manually.
When you have a website with a lot of images, you can try a plugin called Better Search Replace. It's a third-party plugin which automatically replaces your old domain with your new domain in your database.
Note: If you encounter any issues with a plugin, it's best to reach out to the plugin maker for assistance as they are third-party products. Prior to making any modifications, we advise you to create a backup of your website files and database.
- Log in to your WP Admin.
- Click Plugins and then Add New.
- Search for Better Search Replace and install the plugin with that name.
- Click Activate to make the plugin active.
- Click Tools and Better Search Replace.
- Search for the old domain name and Replace with the new domain name.
- Select the tables that you want to search in. Your posts are located in the table that ends on _posts, but usually, you can safely select all tables.
- Uncheck the box for Run as dry run and click Run Search/Replace. If you want to do a test run before making changes, leave the box for Run as dry run checked.
Step 10 - Recheck your site (Optional)
Your website should now have successfully been moved, including images and links. If you encounter any problems, feel free to contact our support for more help.
Don't have a website yet? With WordPress, you can easily and quickly build the website of your dreams.