Migrating your WordPress site from a subdomain to the root domain can seem daunting, but with the right steps, it can be a smooth process. Whether you’re rebranding or simplifying your website structure, this guide will walk you through every necessary step to ensure a successful migration.

Why Move from Subdomain to Root Domain?

06. How To Move A Wordpress Site From A Subdomain To The Root Domain

Moving from a subdomain to a root domain can offer several advantages for your website’s visibility, branding, and user experience. Here are some key reasons to consider this transition:

SEO Benefits

  • Consolidated Authority: A root domain can consolidate link equity and authority from various subdomains, potentially improving overall search rankings.
  • Simplified Indexing: Search engines may find it easier to crawl and index a single root domain compared to multiple subdomains.

Branding and Recognition

  • Stronger Brand Identity: A root domain often appears more professional and can enhance brand recognition.
  • Easier to Remember: Users may find it easier to remember a single domain rather than multiple subdomains.

User Experience

  • Seamless Navigation: A root domain can create a more cohesive user experience, as visitors won’t need to switch contexts between different subdomains.
  • Unified Content: Keeping content under one domain can make it easier for users to find related information.

Simplified Marketing

  • Unified Analytics: Tracking performance and user behavior can be more straightforward with a single domain, making it easier to analyze data.
  • Consistent Campaigns: Marketing efforts can be more streamlined, reducing confusion when promoting a single site.

Technical Considerations

  • Simplified Management: Managing a single root domain can reduce complexity in terms of hosting, SSL certificates, and DNS settings.
  • Easier Updates: Site updates and maintenance may be simpler when everything resides under one domain.

Step-by-Step Guide to Move WordPress from Subdomain to Root Domain

Step 1: Back Up Your Site

Shutterstock 619374896

Before making any changes, it’s crucial to back up your entire website, including:

Backing Up Your WordPress Files

– Access Your Website via FTP
  1. Download an FTP Client: If you haven’t already, download an FTP client like FileZilla.
  2. Connect to Your Server:
    • Open FileZilla and enter your FTP credentials (host, username, password, and port).
    • Click “Quickconnect” to connect to your server.
– Locate Your WordPress Directory
  • Once connected, navigate to the directory where your WordPress files are stored. This is often in a folder named after your subdomain or public_html.
– Download Your Files
  1. Select All Files: Highlight all files and folders in your WordPress directory (including wp-content, wp-admin, and wp-includes).
  2. Download: Right-click and select “Download” to save them to a local folder on your computer. This may take some time depending on the size of your site.

Backing Up Your WordPress Database

The database stores all your posts, pages, comments, and settings, so it’s crucial to back it up as well.

– Access phpMyAdmin
  1. Log into Your Hosting Control Panel: This is often cPanel or a similar interface.
  2. Find phpMyAdmin: Look for the phpMyAdmin icon and click on it to access your databases.
– Select Your Database
  1. Choose Your Database: On the left sidebar, find and click on the database associated with your WordPress site. If you’re unsure, check your wp-config.php file in your FTP client for the database name.
– Export Your Database
  1. Click on Export: Once your database is selected, click the “Export” tab at the top of the page.
  2. Choose Export Method: Select the “Quick” export method and the format as “SQL.”
  3. Download the File: Click “Go” to download the database file to your local machine.

Step 2: Prepare the Root Domain

Before moving your WordPress site from a subdomain to a root domain, it’s essential to ensure that your root domain is properly set up and ready to host your site. Here’s how to prepare your root domain step by step.

Url Domain Types

– Register Your Domain

If you haven’t already done so, register your root domain with a domain registrar. Popular registrars include:

  • GoDaddy
  • Namecheap
  • Google Domains

Make sure you have access to the domain management dashboard.

– Choose a Hosting Plan

Select a hosting provider that supports WordPress. Some popular options include:

  • Bluehost
  • SiteGround
  • HostGator
  • WP Engine

Ensure that your chosen plan has enough resources (storage, bandwidth) for your site.

– Set Up Hosting

Once you’ve purchased your hosting plan:

  1. Access Your Hosting Control Panel: This is often cPanel or a custom dashboard provided by your host.
  2. Link Your Domain to Your Hosting Account:
    • Find the “Domains” or “Add Domain” section.
    • Add your root domain to your hosting account.

– Configure DNS Settings

Point your domain to your hosting server by updating the DNS settings:

  1. Find the Nameservers: Your hosting provider will provide nameservers (e.g., ns1.yourhosting.com).
  2. Log in to Your Domain Registrar: Navigate to the DNS settings or nameservers section.
  3. Update Nameservers: Replace the existing nameservers with those provided by your hosting provider.
  4. Save Changes: It may take a few hours for the changes to propagate.

– Install WordPress

Most hosting providers offer a one-click WordPress installation feature. Here’s how to do it:

  1. Access the Control Panel: Look for the WordPress installer (often under “Softaculous” or “Install WordPress”).
  2. Select Your Domain: Choose your root domain for the installation.
  3. Fill in the Details: Provide your site title, admin username, password, and email.
  4. Install WordPress: Click the install button and wait for the process to complete.

– SSL Certificate

To ensure your site is secure, install an SSL certificate:

  1. Check for Free SSL: Many hosts provide free SSL through Let’s Encrypt.
  2. Install SSL: Follow your host’s instructions to enable SSL for your domain.
  3. Force HTTPS: Update your .htaccess file or use a plugin to redirect all traffic to HTTPS.

– Set Up Basic Settings

Once WordPress is installed:

  1. Log in to Your WordPress Dashboard: Visit https://example.com/wp-admin.
  2. Configure General Settings: Go to Settings > General and ensure your site title and tagline are set.
  3. Set Permalinks: Navigate to Settings > Permalinks and choose a URL structure (e.g., Post name).

– Install a Theme and Essential Plugins

    1. Choose a Theme: Go to Appearance > Themes to select or upload a theme.
    2. Install Essential Plugins: Consider plugins for SEO (e.g., Yoast SEO), security (e.g., Wordfence), and backups (e.g., UpdraftPlus).

Step 3: Move Files from Subdomain to Root Domain

Transferring your WordPress files from a subdomain to the root domain is a critical step in the migration process. Here’s a detailed guide on how to do it effectively.

– Access Your Subdomain Files

To start, you need to access the files on your subdomain. You can do this using an FTP client or your hosting provider’s file manager.

Using an FTP Client

  1. Download and Install an FTP Client: If you don’t have one, consider using FileZilla.
  2. Connect to Your Server:
    • Open your FTP client.
    • Enter your FTP credentials (host, username, password, port) provided by your hosting provider.
    • Click “Connect.”
  3. Navigate to Your Subdomain Directory:
    • Locate the directory for your subdomain (e.g., subdomain.example.com).

Using File Manager

  1. Log in to Your Hosting Control Panel: Go to your hosting provider’s dashboard.
  2. Open File Manager: Look for an option labeled “File Manager” or similar.
  3. Navigate to the Subdomain Directory: Find and open the directory for your subdomain.

– Download Files from the Subdomain

Using FTP Client

  1. Select All Files: Highlight all files and folders in your subdomain directory.
  2. Download Files: Right-click and choose the option to download. This may take some time depending on the size of your site.

Using File Manager

  1. Select All Files: Highlight all files and folders in the subdomain directory.
  2. Download: Look for a download option, or compress the files into a ZIP file for easier downloading.

– Upload Files to the Root Domain

Next, you will upload these files to the root domain directory.

Using FTP Client

  1. Navigate to Your Root Directory: Once connected to your server, find the root directory (often public_html or www).
  2. Upload Files:
    • Drag and drop the downloaded files from your computer to the root directory.
    • Ensure all files and folders are uploaded correctly.

Using File Manager

  1. Navigate to the Root Directory: Open the root directory.
  2. Upload Files:
    • Select the option to upload files.
    • If you compressed your files into a ZIP, upload the ZIP file and extract it in the root directory.

– Verify File Transfer

After uploading, it’s crucial to verify that all files have been transferred correctly.

  1. Check File Structure: Ensure that the folder structure matches what you had in your subdomain.
  2. Confirm Key Files: Make sure essential files like wp-config.php, .htaccess, and folders like wp-content, wp-admin, and wp-includes are present.

– Set Permissions (if necessary)

Sometimes, file permissions may need to be adjusted after transferring files.

  1. Select Files/Folders: In your FTP client or file manager, select the files and folders you’ve just uploaded.
  2. Change Permissions: Set folders to 755 and files to 644 to ensure proper access and security.

Step 4: Update the Database

  1. Access phpMyAdmin: Log in to your hosting control panel and access phpMyAdmin.
  2. Modify wp_options Table:
    • Locate the wp_options table (prefix may vary).
    • Update the siteurl and home URLs to reflect your root domain (e.g., https://yourrootdomain.com).
  3. Search and Replace: Use a search-and-replace tool (like the Better Search Replace plugin) to update URLs in your database:
    • Search for https://subdomain.yourdomain.com.
    • Replace with https://yourrootdomain.com.

Step 5: Update the wp-config.php File

  1. Open the File: Right-click on wp-config.php and select the option to edit.
  2. Update Site URL (if necessary):
    • Although the site URL is primarily managed in the database, you can add the following lines to ensure that WordPress recognizes the correct domain:
    define('WP_HOME', 'http://example.com');
    define('WP_SITEURL', 'http://example.com');
    

    Replace http://example.com with your actual root domain.

  3. Check Database Settings: Ensure the database name, username, password, and host are correct. This information should match the database you are using for your WordPress installation.
    /** The name of the database for WordPress */
    define('DB_NAME', 'database_name_here');
    
    /** MySQL database username */
    define('DB_USER', 'username_here');
    
    /** MySQL database password */
    define('DB_PASSWORD', 'password_here');
    
    /** MySQL hostname */
    define('DB_HOST', 'localhost');
    

    Make sure these values correspond to your current database settings

  1. Log into WordPress: Access your WordPress dashboard at the root domain.
  2. Reset Permalinks: Go to Settings > Permalinks and click “Save Changes” to refresh your permalink structure. This step helps avoid 404 errors.

Step 7: Test Your Site

  1. Check Functionality: Visit your root domain and check that everything is functioning correctly, including links, images, and functionality.
  2. Inspect for Errors: Use tools like Google Search Console to identify any crawl errors.

Step 8: Redirect Subdomain Traffic (Optional)

If you want to ensure visitors to your subdomain are redirected to the root domain:

  1. Add Redirects: Use a .htaccess file in your subdomain directory to redirect traffic:
    apache
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^subdomain\.yourdomain\.com [NC]
    RewriteRule ^(.*)$ https://yourrootdomain.com/$1 [L,R=301]
    

Step 9: Update Google Search Console and Analytics

  1. Google Search Console: Add your root domain and submit a change of address to inform Google of the move.
  2. Google Analytics: Update the tracking code to reflect the new domain.

Conclusion

Moving your WordPress site from a subdomain to a root domain is a manageable process when you follow the steps carefully. By backing up your site, updating your database, and ensuring all links and functionalities are intact, you can make the transition with minimal disruption.

With a successful migration, you’ll enjoy improved SEO, a better user experience, and simplified site management. Happy migrating!

Rate for post
Lt Digital Team (Content &Amp; Marketing)
Latest posts by LT Digital Team (Content & Marketing) (see all)

Summer Sale Grab 50% Off for everything on today, don't miss it. Coupon code: SUMMER2024 Redeem Now
Last call: Summer Sale! Grab 50% Off for everything on today, don't miss it. Coupon code: SUMMER2024 Redeem Now