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:
- Make sure you have a backup of your original WordPress site, including the database and files.
- Verify that you have the necessary permissions to access the new domain and its associated hosting account.
Step 1: Set up the new domain
- Register the new domain and set up its hosting account.
- Point the new domain's DNS settings to the same server as the original domain (if you're using the same hosting provider).
- Wait for the DNS changes to propagate (this may take up to 48 hours).
Step 2: Create a new database and user
- Log in to your hosting account's control panel (e.g., cPanel) and create a new database.
- Create a new MySQL user and grant them access to the new database.
- Note down the database name, username, and password.
Step 3: Export the original database
- Log in to your original WordPress site's dashboard.
- Go to Tools > Export > All Content.
- Choose the "WordPress" format and select all tables.
- Download the exported database file.
Step 4: Import the database to the new database
- Log in to your hosting account's control panel (e.g., cPanel) and navigate to the new database.
- Click on the "phpMyAdmin" icon.
- Click on the "Import" tab.
- Select the exported database file and click "Go".
- Wait for the import process to complete.
Step 5: Upload the WordPress files
- 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.
- Make sure to upload the files to the correct directory (e.g., public_html or www).
Step 6: Update the database settings
- 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 nameDB_USER
: the new MySQL userDB_PASSWORD
: the new MySQL passwordDB_HOST
: the hostname of the new database (usuallylocalhost
)
- Save the changes to the
wp-config.php
file.
Step 7: Update the site URL
- Log in to the new WordPress site's dashboard.
- Go to Settings > General and update the "WordPress Address" and "Site Address" fields to the new domain.
- Click "Save Changes".
Step 8: Update any hardcoded URLs
- Search for any hardcoded URLs in the site's files (e.g., theme files, plugins) and update them to the new domain.
- Use a search and replace tool (e.g., Search and Replace plugin) to make the process easier.
Step 9: Test the site
- Visit the new site to ensure it's working correctly.
- 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.