Moving a WordPress site across domains can be a complex task, but with careful planning and execution, it can be done smoothly. Here's a step-by-step tutorial on how to move a WordPress site to a new domain:

Note: This tutorial assumes you have access to your WordPress dashboard and your server via FTP or a control panel like cPanel.

Step 1: Backup Your WordPress Site

Before making any changes, it's essential to create a full backup of your WordPress site, including your files and the database. You can use backup plugins like UpdraftPlus or manually back up your site using FTP and phpMyAdmin.

Step 2: Set Up the New Domain

Make sure you have purchased and set up the new domain where you want to move your WordPress site. Ensure that the domain is properly configured with your hosting provider, and the DNS records are updated to point to your server.

Step 3: Copy Your Files

  1. Using FTP or your hosting control panel, connect to your old domain's server.
  2. Navigate to the root directory of your WordPress site (usually, it's the public_html folder).
  3. Download all the files and folders to your local computer.

Step 4: Export the Database

  1. Access your hosting control panel and open phpMyAdmin.
  2. Select the database associated with your WordPress site.
  3. Click on the "Export" tab.
  4. Choose the "Quick" export method and select the SQL format.
  5. Click the "Go" button to download the database backup file.

Step 5: Upload Files to the New Domain

  1. Using FTP or your hosting control panel, connect to your new domain's server.
  2. Navigate to the root directory of your new WordPress site.
  3. Upload all the files and folders from your local computer to the new domain.

Step 6: Import the Database

  1. Access phpMyAdmin on the server of your new domain.
  2. Create a new database (if not already done) and import the SQL file you downloaded earlier into this new database.

Step 7: Update wp-config.php

  1. In your WordPress site's root directory on the new domain, locate the wp-config.php file.
  2. Open it with a text editor.
  3. Find the following lines:
define('DB_NAME', 'old_db_name');
define('DB_USER', 'old_db_user');
define('DB_PASSWORD', 'old_db_password');
define('DB_HOST', 'localhost');
  1. Update these lines with the new database information:
define('DB_NAME', 'new_db_name');
define('DB_USER', 'new_db_user');
define('DB_PASSWORD', 'new_db_password');
define('DB_HOST', 'localhost');

Step 8: Search and Replace URLs

To update internal links and references to your old domain with the new one, you can use a search and replace tool. One popular option is the "Better Search Replace" plugin.

  1. Install and activate the plugin.
  2. Go to "Tools" > "Better Search Replace."
  3. Enter your old domain in the "Search for" field and your new domain in the "Replace with" field.
  4. Select the tables you want to search and replace in (usually all tables).
  5. Click the "Run Search/Replace" button.

Step 9: Update Permalinks

Go to your WordPress dashboard on the new domain, navigate to "Settings" > "Permalinks," and click the "Save Changes" button to refresh your permalinks.

Step 10: Test Your Site

Visit your new domain to ensure everything is working correctly. Test various pages, posts, and functionality to ensure that the migration was successful.

Step 11: Update DNS Records

Once you've confirmed that your new site is working correctly, you can update your DNS records to point your old domain to the new one. This step may take some time to propagate across the internet.

Step 12: Monitor and Troubleshoot

Keep an eye on your site for any issues, broken links, or missing resources. If you encounter problems, use the WordPress Debug mode and server error logs to troubleshoot and resolve them.

Moving a WordPress site to a new domain is a detailed process, and careful execution is crucial to ensure a smooth transition. Always perform these steps on a staging or backup site first to avoid any unexpected issues on your live site.