Duplicate wordpress site to new domain

A common task! Here's a step-by-step guide on how to duplicate a WordPress site to a new domain:

Before you start:

  1. Make sure you have a backup of your original WordPress site, including the database and files.
  2. Verify that you have the necessary permissions to access the new domain and its associated hosting account.

Step 1: Set up the new domain

  1. Register the new domain and set up its hosting account.
  2. Point the new domain's DNS settings to the same server as the original domain (if you're using the same hosting provider).
  3. Wait for the DNS changes to propagate (this may take up to 48 hours).

Step 2: Create a new database and user

  1. Log in to your hosting account's control panel (e.g., cPanel) and create a new database.
  2. Create a new MySQL user and grant them access to the new database.
  3. Note down the database name, username, and password.

Step 3: Export the original database

  1. Log in to your original WordPress site's dashboard.
  2. Go to Tools > Export > All Content.
  3. Choose the "WordPress" format and select all tables.
  4. Download the exported database file.

Step 4: Import the database to the new database

  1. Log in to your hosting account's control panel (e.g., cPanel) and navigate to the new database.
  2. Click on the "phpMyAdmin" icon.
  3. Click on the "Import" tab.
  4. Select the exported database file and click "Go".
  5. Wait for the import process to complete.

Step 5: Upload the WordPress files

  1. Upload the WordPress files from the original site to the new site using an FTP client (e.g., FileZilla) or the hosting account's file manager.
  2. Make sure to upload the files to the correct directory (e.g., public_html or www).

Step 6: Update the database settings

  1. Open the wp-config.php file in a text editor and update the database settings to match the new database:
    • DB_NAME: the new database name
    • DB_USER: the new MySQL user
    • DB_PASSWORD: the new MySQL password
    • DB_HOST: the hostname of the new database (usually localhost)
  2. Save the changes to the wp-config.php file.

Step 7: Update the site URL

  1. Log in to the new WordPress site's dashboard.
  2. Go to Settings > General and update the "WordPress Address" and "Site Address" fields to the new domain.
  3. Click "Save Changes".

Step 8: Update any hardcoded URLs

  1. Search for any hardcoded URLs in the site's files (e.g., theme files, plugins) and update them to the new domain.
  2. Use a search and replace tool (e.g., Search and Replace plugin) to make the process easier.

Step 9: Test the site

  1. Visit the new site to ensure it's working correctly.
  2. Test all pages, posts, and functionality to ensure everything is working as expected.

That's it! Your WordPress site should now be duplicated to the new domain.