how to move WordPress site from subdomain to main domain

Choosing the Right Time and Preparing for Migration

Migrating your WordPress site from a subdomain to a main domain is a significant step that can greatly impact your site’s visibility and traffic. It’s ideal to choose a low-traffic period for migration to minimize disruptions. Before starting, always back up your entire WordPress site, including all files and the database, to avoid data loss in case issues arise during the migration.

Step 1: Backup Your Website

Use plugins like UpdraftPlus or manually export your database via phpMyAdmin and copy your WordPress files through FTP. This ensures you can restore the original state if needed.

Step 2: Preparing the Main Domain

Ensure that your main domain is ready to host the WordPress site. This implies setting up a web hosting environment. Most hosts provide a WordPress-specific hosting environment which eases the migration and setup processes.

Step 3: Clone Your Website

To move your WordPress site, consider cloning it with a plugin such as Duplicator, which simplifies moving files and databases. After installing and activating the plugin on your subdomain:

  • Choose to create a new package.
  • Follow the plugin instructions to clone your site; this includes your WordPress database, files, and directories.
  • Download the archive and installer files once the package is ready.

Step 4: Uploading to the Main Domain

Upload the previously downloaded installer and archive files to the root directory of your main domain, usually public_html/, through an FTP client (like FileZilla) or File Manager in your web hosting control panel.

Step 5: Creating a Database for the Main Domain

Before you run the installer on your main domain, you must create a MySQL database:

  • Go to your hosting control panel and find the MySQL Database Wizard.
  • Create a new database, a database user, and ensure the user has all privileges to manage the database.

Step 6: Running the Duplicator Installer

Navigate to http://yourmaindomain.com/installer.php and run the installer:

  • Follow the on-screen setup wizard to connect the database you just created.
  • The wizard will prompt you to update URLs or paths that need adjustment.

Step 7: Testing Your Site

Once the migration processes are complete, check the entire site for any broken links or errors. Tools like Broken Link Checker can aid in this process. Ensure that everything operates as smoothly as it did on the subdomain.

Step 8: Updating the WordPress Address

Within WordPress Settings:

  • Update the WordPress Address (URL) and Site Address (URL) to reflect the new domain name.
  • This ensures that the general settings are in line with the new domain.

Step 9: Setting Up Redirects

To maintain SEO rankings and provide a good user experience, set up 301 redirects from your subdomain to your new domain. This can be done via the .htaccess file which is located in the root folder of your subdomain:

  • Use the following rule: Redirect 301 / http://yourmaindomain.com/
  • This tells search engines that your site has moved permanently.

Step 10: Notify Google of the Change

Update your Google Search Console:

  • Remove your old subdomain and add your new domain.
  • Submit a new sitemap for the main domain.

Keeping an Eye on Your Site’s Performance

Monitor your website’s performance and check analytics frequently to catch any unexpected dips in traffic or SEO rankings. Adjustments might be needed in your configurations or redirects.

Ongoing Maintenance and Security

Regularly update your site and maintain robust security practices to protect your new setup. Consider implementing a regular backup schedule for your main domain to safeguard against data loss.

By methodically following these steps, moving a WordPress site from a subdomain to the main domain can be executed smoothly, helping enhance your site’s performance and potentially boosting your online presence.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *