How to move wordpress site to new domain
Moving a WordPress site to a new domain can be a bit of a process, but it's definitely doable. Here's a step-by-step guide to help you through the process:
Before you start:
- Backup your site: Make sure to backup your WordPress site, including the database and files, before making any changes. This will ensure that you can restore your site if anything goes wrong during the transfer process.
- Update your DNS: Update your DNS (Domain Name System) settings to point to the new domain. This may take some time to propagate, so be patient.
Step 1: Update your WordPress configuration
-
Update the
wp-config.php
file: Open thewp-config.php
file in a text editor and update theDB_HOST
,DB_USER
, andDB_PASSWORD
variables to reflect the new database settings. -
Update the
wp_options
table: Run the following SQL query to update thewp_options
table with the new domain:UPDATE wp_options SET option_value = REPLACE(option_value, 'old-domain.com', 'new-domain.com') WHERE option_name = 'site_url' OR option_name = 'home_url';
Step 2: Update your site's URLs
-
Update the
wp_options
table: Run the following SQL query to update thewp_options
table with the new domain:UPDATE wp_options SET option_value = REPLACE(option_value, 'old-domain.com', 'new-domain.com') WHERE option_name = 'site_url' OR option_name = 'home_url';
-
Update the
wp_posts
table: Run the following SQL query to update thewp_posts
table with the new domain:UPDATE wp_posts SET post_content = REPLACE(post_content, 'old-domain.com', 'new-domain.com');
Step 3: Update your theme and plugins
-
Update your theme: If your theme uses hardcoded URLs, you may need to update them manually.
-
Update your plugins: Check your plugins for hardcoded URLs and update them as needed.
Step 4: Update your DNS
- Update your DNS settings: Update your DNS settings to point to the new domain. This may take some time to propagate.
Step 5: Test your site
- Test your site: Test your site to ensure that everything is working as expected.
Additional tips:
- Use a plugin: Consider using a plugin like Duplicator or UpdraftPlus to help you move your site to a new domain.
- Use a staging site: Set up a staging site and test the transfer process before moving your live site.
- Be patient: The transfer process may take some time, so be patient and don't rush through it.
By following these steps, you should be able to successfully move your WordPress site to a new domain. Good luck!