Migrating Your Website

Feb 15, 2024 | Hosting

Reading Time: 10 minutes

A Step-by-Step Guide to Moving Your WordPress Site to a New Domain With SEO Preservation

Photo by Justin Morgan on Unsplash

Migrating a WordPress website to a new domain can be a daunting task, especially when concerned about preserving your SEO rankings during the transition. The process involves careful planning, precise execution, and post-migration cleanup to ensure your website continues to function seamlessly under its new domain name. It is vital to approach this migration with a clear strategy—beginning with a full backup of your website’s content, themes, and plugins to safeguard your data against any potential loss.

The technical aspects of the migration require setting up the new domain, creating a compatible database, and adjusting the wp-config.php file to reflect these changes. Once the site files and database have been successfully migrated, domain redirection is necessary to guide traffic from the old domain to the new one. After implementation, meticulously testing the website on its new domain ensures everything operates correctly. To sustain the SEO integrity of your site, updating Google Search Console with your new domain’s information is crucial, followed by a post-migration cleanup to discard any unnecessary files and data.

Key Takeaways

  • Reliable backups and methodical preparations are pivotal to successful WordPress site migration.
  • Accurate domain configuration and careful data transfer are imperative for maintaining website performance.
  • Updating Search Console and post-migration checks play crucial roles in preserving SEO rankings.

Preparing for Migration

Before embarking on the migration of a WordPress site to a new domain, it is crucial to ensure that the site’s assets are secure and to establish a clear plan of action to maintain SEO rankings.

Evaluating Your Current Hosting Provider

The first step in the preparation process is to assess whether the current hosting provider meets the requirements for the new domain. One should consider the host’s reliability, speed, customer service, and compatibility with WordPress. If the existing host falls short, migrating to a more suitable hosting environment might be necessary. Migration can be smoother if the current host offers direct support for WordPress sites, as it can significantly reduce the complexity of the move.

Creating a Detailed Migration Checklist

A thorough migration checklist is vital to prevent crucial steps from being overlooked, which can result in website downtime or SEO penalties. This checklist should include:

  • Full Backup: Create a complete backup of the WordPress website, encompassing all files, databases, and content. Utilize plugins or manual methods to ensure the backup is comprehensive and stored in a secure location.
  • Domain Purchase and Setup: Confirm that the new domain is purchased, registered, and configured correctly with the new host, if applicable.
  • URL Structure Outline: Inventory the current site’s URL structure to assist with redirect mapping to the new domain, preserving SEO rankings.
  • Temporary Domain Setup: Configure a temporary domain or a subdomain to test the site during migration, avoiding interruptions to the live site.
  • Search Engine Preparation: Plan for updating Google Search Console with the new domain information post-migration to continue tracking site performance and manage indexing.

Backup Your WordPress Site

Before initiating a domain change, securing a complete backup of the WordPress site is critical. This includes a database backup as well as a files and content backup to ensure a seamless restoration process if needed.

Database Backup

The database contains vital WordPress site information including posts, comments, and settings. To back up the database, access phpMyAdmin from the web hosting control panel. Locate the specific database for the WordPress site, then select the ‘Export’ option. Choose the ‘Quick’ export method and the ‘SQL’ format. Click ‘Go’ to download the .sql file, which holds content details specific to the site, such as user data and site configurations.

Files and Content Backup

For the files and content, an FTP client like FileZilla is capable of downloading the entire WordPress directory to a local computer. Connect to the web host with the FTP credentials provided. Navigate to the directory where WordPress is installed, often labeled as ‘public_html’ or ‘www’. Select all files and folders inside the installation directory and download them to a secure location on the local machine. This action preserves themes, plugins, and media uploads, ensuring no aspect of the site’s appearance or functionality is lost during the transition.

Setting Up the New Domain

When migrating a WordPress site, establishing a new domain is a foundational step. This process involves meticulous attention to detail to maintain your website’s integrity and search engine ranking.

Registering New Domain

The initial phase requires registering the desired domain name. This is typically done through a reputable domain registrar. It is crucial to choose a domain that reflects your brand and is easy for users to remember. Options can be explored at Domain Finders where various choices for domain names that suit your business needs can be found. Once purchased, this new domain will serve as the address where your existing WordPress site will relocate.

Configuring DNS Settings

After securing the new domain, the next critical task is configuring the Domain Name System (DNS) settings. This process will point the new domain to your existing hosting provider’s server where your website is currently housed. The DNS settings are accessed through your domain registrar’s dashboard. Here, one should update the A record to reflect the IP address of the hosting server, which makes the website accessible at the new domain. Changes to DNS records can take up to 48 hours to propagate throughout the internet, so this step should be done with time to spare before the full migration.

Creating a New Database for the New Domain

When migrating a WordPress site to a new domain, creating a fresh database at the new host is critical. This database will store all the WordPress site’s content and settings.

Using cPanel and phpMyAdmin

One must first log into the cPanel dashboard of their new hosting account. Look for the Databases section, and select MySQL Databases to create a new database. Assign a name to the database, keeping it concise and distinctive. After creating the database, add a new user with a strong password, and make sure to grant all privileges to this user for the newly created database.

Next, navigate to phpMyAdmin in the cPanel. There, one will be able to see the newly created database listed. Before importing the site’s data, ensure that it’s empty.

Importing SQL Database

To import the SQL database from the old domain, go to phpMyAdmin and click on the new database name in the left-hand sidebar. Click the Import tab at the top of the page. Then, click Choose File to select the .sql file that was previously exported from the old website’s database. Double-check the charset and collation settings to ensure compatibility. Hit the Go button to import the database file into the new MySQL database.

Updating wp-config.php File

Before proceeding with the new domain configuration, one must carefully update the wp-config.php file. This is a critical step in ensuring the WordPress site connects to the right database containing all the existing content and settings.

Database Information

In the wp-config.php file, locate the section that defines the four crucial constants related to the database settings. These constants are DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST. One will need to ensure that these values match the new database’s information where WordPress data has been imported.

define('DB_NAME', 'your_database_name');
define('DB_USER', 'your_database_username');
define('DB_PASSWORD', 'your_database_password');
define('DB_HOST', 'localhost');
  • DB_NAME is set to the name of the database for WordPress.
  • DB_USER is the username with access to the database.
  • DB_PASSWORD is the password for the database user.
  • DB_HOST typically remains ‘localhost’ unless the new hosting provider specifies otherwise.

New Domain Configuration

Changing the domain requires an update to the wp-config.php file to define the site’s new URL. The following two lines should be added to the file, substituting ‘your_new_domain.com’ with the actual new domain name:

  • WP_HOME represents the address where the WordPress core files reside.
  • WP_SITEURL is the domain address visitors will use to access the WordPress site.

After these changes, save the wp-config.php file and upload it to the server. These updates will enable WordPress to recognize the new domain and establish a connection with the updated database, facilitating a seamless transition.

Migrating Site Files and Database

The migration of site files and database is a critical step in moving a WordPress site to a new domain. It ensures that the website’s content and structure are preserved in the transition.

Manual File Transfer

One must approach the manual transfer with precision to maintain the website’s integrity. The process involves copying all WordPress files from the existing hosting account to the new domain’s hosting environment. Utilize a File Transfer Protocol (FTP) client, like FileZilla, or the hosting provider’s file manager for this task. To begin, connect to your old hosting account via FTP, navigate to the directory containing your WordPress site, and download all files to your local computer.

Once the files are on your computer, connect to the new hosting account and upload them to the appropriate directory, which is usually named ‘public_html’ or ‘www’. Double-check that all files, including hidden “.htaccess” ones, are uploaded correctly. Following the file upload, export the WordPress database from the old host using phpMyAdmin and import it into the new host’s database.

Automated Migration with Plugins

Migration plugins offer a less manual, more user-friendly approach to migration. When choosing a migration plugin, it’s important to select one that is reliable and well-rated by the WordPress community. Plugins like Duplicator, All-in-One WP Migration, and WP Migrate DB simplify the process to a few clicks.

To start with a plugin, install and activate your chosen tool on your existing WordPress site. Follow the plugin’s steps to bundle your files and database into one package. Once the package is complete, you’ll download it. Then, navigate to the WordPress installation on your new domain, and using the same plugin, upload and deploy the package. The plugin will handle the unpacking of the files and database, ensuring that all data is transferred seamlessly to the new domain.

Configuring Domain Redirection

When migrating a WordPress site to a new domain, it’s crucial to implement domain redirection properly. This ensures that visitors and search engines are directed to the correct site, preserving SEO rankings.

Setting Up 301 Redirects

To set up 301 redirects, one must first map the old URLs to the new ones. This type of redirect is a permanent redirect that passes most of the link equity (ranking power) to the redirected page. In WordPress, there are plugins that can assist with this process, but it can also be done manually. Here’s a simple outline:

  1. Choose a WordPress redirection plugin or plan to modify the .htaccess file directly.
  2. Map out all old URLs and their corresponding new URLs.
  3. Implement the redirects accordingly.
    • For plugins, follow the instructions provided by the plugin to create redirects.
    • To manually set redirects, you’ll need to edit the .htaccess file.

Editing .htaccess File

The .htaccess file plays a pivotal role in the redirection process for WordPress sites hosted on Apache servers. To edit this file:

  1. Access your site’s root folder via FTP or cPanel’s File Manager.
  2. Locate and download the .htaccess file as a backup.
  3. Open the file with a text editor and insert the 301 redirect code.

For example, to redirect a single page:

Redirect 301 /old-page.html /new-page.html

To redirect an entire site:

Redirect 301 / https://www.newdomain.com/
  1. Save the changes and upload the .htaccess file back to the server.
  2. Test the redirects by visiting the old URLs to ensure they point to the new domain correctly.

Testing the Site on the New Domain

Once the migration to the new domain is complete, a meticulous testing procedure is vital to ensure the WordPress site functions correctly. This phase is critical to maintain SEO rankings and provide a seamless user experience.

Checking for Broken Links

Step 1: Utilize tools like Screaming Frog SEO Spider or an online broken link checker to scan for dead URLs on the new domain.

Step 2: Manually click through the site to confirm that all internal links are redirecting to the correct pages on the new domain.

It’s important to remember that even redirects that seem to work properly need to be tested to ensure they point to the new domain and not back to the old one. Broken links can negatively impact SEO, so this step is crucial.

Ensuring Plugin Compatibility

Plugin Checklist:

  1. Update URLs: Ensure all plugins that might store absolute URLs are updated to reflect the new domain.
  2. Test Each Plugin: Deactivate and reactivate plugins one at a time to check for issues on the new domain.
  3. Review Settings: For plugins that handle redirects, such as SEO plugins, revise settings to avoid pointing back to the old URL.

Testing each plugin’s functionality can prevent unforeseen errors and ensure that features reliant on them, like forms or ecommerce systems, remain operational. Compatibility with the new domain’s themes and server environment should also be confirmed to avoid any conflicts.

Updating Google Search Console

When a WordPress site is moved to a new domain, updating Google Search Console is crucial to maintain SEO rankings. This involves informing Google of the domain change and monitoring traffic for indexing issues.

Informing Google of the New Domain

After migrating a WordPress site, the website administrator should add and verify the new domain in Google Search Console immediately. This is accomplished by:

  1. Accessing the Google Search Console dashboard.
  2. Using the ‘Add Property’ button to add the new domain.
  3. Verifying ownership of the new domain by using a method provided by Google, such as an HTML file upload, a DNS record, or through Google Analytics.

It’s essential that the verification be completed promptly to ensure Google recognizes the new domain as the primary address for the content.

Monitoring Traffic and Indexing

Once the new domain is added and verified, the focus shifts to monitoring traffic and indexing. Key tasks include:

  • Reviewing the coverage report to check that Google is crawling and indexing the new domain effectively.
  • Observing the performance reports to ensure that traffic levels and search engine rankings are stable.

Any significant discrepancies in traffic or indexing should be addressed immediately. It may involve submitting a sitemap through Google Search Console or using the ‘Change of Address’ tool to signal to Google that the site has moved to a new domain. By attentively monitoring Google Search Console, potential SEO issues can be identified and resolved swiftly, securing the site’s search engine rankings during and after the transition.

Maintaining SEO Rankings

When migrating a WordPress site to a new domain, it’s crucial to preserve SEO rankings. This involves meticulous updating of internal links and informing search engines of the domain change through proper channels.

Updating Internal Links

To maintain SEO rankings, ensure all internal links point to the new domain URLs. This can be done using a search and replace plugin in WordPress, replacing old domain URLs with the new ones. It’s vital to update links in posts, pages, widgets, and navigation menus.

  • Posts & Pages: Check and update any links within the content.
  • Widgets: Modify links in custom widgets.
  • Navigation Menus: Update any custom links in your site’s menus.

Correcting internal links minimizes the number of redirects, which can affect page load times and in turn, SEO rankings.

Submitting a Change of Address

A Change of Address in Google Search Console informs Google of the domain change and helps to maintain SEO rankings. It’s a two-step process:

  • Verify the New Domain: Before submission, verify ownership of the new domain in Google Search Console.
  • Submit the Change of Address: Under the old domain’s Search Console profile, use the Change of Address tool to notify Google of the new domain.

Additionally, set up 301 redirects for all old URLs to redirect to the corresponding new URLs. This signals search engines that a page has permanently moved, transferring most of the SEO rankings to the new domain.

  • .htaccess or Plugins: Implement 301 redirects manually via the .htaccess file or by using WordPress plugins.

Post-Migration Cleanup

After successfully migrating a WordPress site to a new domain, it’s essential to engage in a post-migration cleanup to ensure that the site remains secure, optimized, and free from any elements that could hinder performance or cause data loss.

Removing Unnecessary Content and Plugins

One should begin by pruning any content that is no longer necessary. This includes old revisions, trashed posts, and media that isn’t linked or in use. It’s efficient to use a plugin designed for database optimization to streamline this process. Plugins that are no longer in use should be deactivated and deleted to improve site performance and security.

  • Content cleanup:
    • Delete trashed posts.
    • Remove unused media files.
  • Plugin management:
    • Deactivate unnecessary plugins.
    • Delete plugin files to increase security.

Final SEO and Performance Checks

Next, carry out a thorough SEO audit to ensure that redirects are appropriately set up, thus preventing any potential data loss in search rankings. It includes verifying that all old domain URLs correctly point to the new domain. A migration plugin can aid in checking for broken links. Additionally, ensuring all WordPress site settings are optimized for performance is critical for maintaining speed and efficiency post-migration.

  • Redirects and SEO checks:
    • Confirm proper 301 redirects.
    • Check for broken links and repair if needed.
  • Performance optimizations:
    • Validate caching mechanisms.
    • Optimize images and scripts for faster loading.