Skip to content
CodeAstrology
Working Hours 9:30 am - 6:30 pm (Sun - Thu)
Contact Us contact@codeastrology.com
CodeAstrology

CodeAstrology

We Develop and Sell WordPress Plugins and Themes

  • Home
  • About
    • Services
    • Company
    • Team
  • Products
    • Premium Products
    • Woo Product Table
    • Min Max Quantity & Step Control
    • UltraAddons
    • Pricing – Add to cart button Changer
  • Blog
  • Contact
  • My Account
    • Support Area
    • Affiliate Area
 0 - $0.00
Get Quote
Transfer WP Site from Subdomain to Main Domain
By Tanzilal Mugdho

How to Transfer WordPress Site from Subdomain to Main Domain (with only 5 steps)

Domain and subdomain, both are pretty similar in terms of use. Although the main domain has the upper priority, you need a subdomain for various purposes. Because of the upper priority, you may need to transfer your WordPress site from the subdomain to the main domain. And it is the right thing to do.
By any chance, your WordPress site is hosted on a subdomain, and you are wondering, “How to transfer WordPress site from subdomain to main domain?” Then you should start reading this article as we are going to show you this process within 5 simple steps.

Table of Contents

  • Transferring WordPress Site from Subdomain to Main Domain with 5 Simple Steps
    • Step 1: Make Sure You Have a Backup of Your Website
    • Step 2: Move Necessary WordPress Files from Subdomain to Root Folder 
    • Step 3: Change the URL of Your WordPress Site and Configure URL Settings
  • Woo Product Table Pro
      • The Most Popular Product Table Plugin For WooCommerce
    • Step 4: Update Related URLs
    • Stage 5. Divert All Subdomain Traffic to The Main Domain
  • Bottom Line

Transferring WordPress Site from Subdomain to Main Domain with 5 Simple Steps

A subdomain is an augmentation of the root domain. That is why the domain always has privilege over its subdomains. To give you an example, website.abc.com can be a subdomain of abc.com, where abc.com is the main or root domain. 

Search engines will treat your website differently if it is hosted on a subdomain. Thus, it will create a negative impact on the SEO score of your website. Therefore, you need to divert web crawlers to the root domain rather than the subdomain. This will assist in preserving your search rank even after you move your website.

Transferring your WordPress site from subdomain to main domain is much easier. Luckily, the process is not as complex as moving a WordPress website to a new domain or new host. If you ask –

“Why is it easy to move WordPress site from subdomain to main domain?”

The answer is pretty simple, it is because both the root and subdomain are hosted with the same web hosting company. Therefore, you don’t need to go through tons of steps. 

So, without further ado, how about we investigate how to move a WordPress site from subdomain to main domain? Let’s begin with the number one step.

Step 1: Make Sure You Have a Backup of Your Website

Before you go through this process, you must have a backup of your WordPress site. To create a backup of your WordPress site, you must have an automated backup solution installed on your website. You don’t have to worry about finding a backup tool, there are tons of WordPress backup plugins available for free.

On the other hand, you may already have a backup plugin installed on your WordPress site. Whether or not you have a backup plugin, you must create a complete backup of your website before moving your WordPress site from the subdomain to the main domain.

You may think – “I have automated backup, I can skip this”. Well, that might be true. But you need to ensure the most recent backup of your site that includes a complete database with all the necessary WordPress files and folders. After creating a complete backup, don’t forget to store it on a secure cloud or on your local storage.

Step 2: Move Necessary WordPress Files from Subdomain to Root Folder 

Before moving your website to the root domain, you have to transfer the necessary files to the root folder. You should have access to your FTP or cPanel. If not, contact your hosting provider immediately. They will give you access to your FTP server or cPanel.

Download database

When you connect to either the FTP server or cPanel, head towards the subfolder location and download all the necessary WordPress files to your computer. After that, locate the public_html folder and open it, which can be found inside the root domain.

Please Note:

The public_html folder can be named as ‘www’ or after your domain name. It depends on the hosting environment.

In this folder, upload all the files that you have downloaded earlier from the root directory.

Upload database

Step 3: Change the URL of Your WordPress Site and Configure URL Settings

After successfully moving the WordPress files, you will gain access to the WordPress admin panel of the root domain. However, when you try to log in to the admin area of the root website, it will render you back to the admin area of the subdomain.

If this bothers you, then you need to fix it. Follow these quick steps below to change the URL of the WordPress site and configure your URL settings -First, switch to the FTP client and head towards the root directory of your domain.

1. First, switch to the FTP client and head towards the root directory of your domain.

2. Here, you need to edit the wp-config.php file. Open the file and add the following code right before the line, where it says – “That’s all, stop editing! Happy blogging”.

define(‘WP_HOME’,’http://example.com’);
define(‘WP_SITEURL’,’http://example.com’);
Please Note:

You need to replace example.com with your domain name. If you prefer using ‘www’ for the root website, you should add the ‘www’ prefix to the URL. 

3. Now, you have to upload the wp-config.php file on the website after you have saved the changes.

After applying the above steps, you will be able to visit the admin area of your WordPress site from the root domain name. 

special offer for code astrology

Woo Product Table Pro

The Most Popular Product Table Plugin For WooCommerce

Get Special Discount

Step 4: Update Related URLs

Even if you have moved your WordPress site to the root domain, there will be links pointing to the subdomain of your WordPress site. Now, where can you find these links? These links can be found inside the WordPress database.

To fix this issue, we will show you the easiest method rather than other critical steps that involve coding.

There is a plugin called Velvet Blues Update URLs. You need to install and activate it. Once you have done that, go to (Tools » Update URLs) inside the plugin folder.

Update URL using Velvet Blues Update URL

On this page, you would like to enter your subdomain Universal Resource Locator (URL) next to the old URL. Then, set your root domain as the new URL. Next, beneath the “Choose which URLs should be updated” area, you need to check all choices except “All GUIDs”.

If you have done that, click the “Update URLs Now” button to continue. After clicking the button, all the URLs inside the WordPress database will be updated. This may take a while, so sit back and relax as you will get a success message once it is done.

Handpicked article for you –

How to integrate Zoom into your WordPress site? (+Top 5 plugins)

Stage 5. Divert All Subdomain Traffic to The Main Domain

We are almost there. To transfer your WordPress website from the subdomain to the root domain, you have to make sure all the traffic of the subdomain is redirected to the root domain. To make it happen, go to the subdomain folder and make the hidden files visible (if there are any).

If you are visiting as an FTP client, there should always be an option to make the hidden files visible. For instance, you can make the hidden files visible inside the cPanel File Manager by navigating towards Settings, which can be found at the top right corner of the screen.

Read this –

If you want an internship (remote) in WordPress

This will bring a popup window (named ‘Preferences’). Inside the popup window, you just need to select “Show Hidden Files” and hit the Save button.

Show hidden files in Preferences

And if you are using FileZilla, the option to show the hidden files will be under Server. Then, you need to check the “Force Showing Hidden Files” option. That’s it.

Show hidden files in FileZilla

You can delete the .htaccess file if the subdomain folder already has one. Then, create a new .htaccess file. To make it functional, copy and paste the following code inside it – 

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^yoursubdomain\.example\.com$ [NC]
RewriteRule ^(.*)$ “http://example.com/$1” [R=301,L]
</IfModule>
Please Note:

Here, yoursubdomain will be replaced with your actual domain and example.com will be replaced with your domain name.

Also, add the ‘www’ prefix to your URL if you prefer to use ‘www’ in your root domain

Once everything is done, save the changes inside the .htaccess file and upload it to the server. Great! Now you know how to transfer WordPress site from subdomain to main domain 

Bottom Line

Well, we hope you got your answer to – how to transfer WordPress site from subdomain to main domain. Before you begin the transfer, please make sure you have sufficient backup of your database and other necessary files. Also, the other procedures that we have mentioned earlier in this article. And two important things for moving your website from subdomain to main domain are –

  • Removing files from the public_html directory from your previous websites (if any).
  • No other folders except the files of your designated website are available in the root directory.

We hope the process was plain and simple. But if you got stuck with any of these steps, please let us know by leaving a comment below. We will be glad to give you a piece of quick advice.

Subdomain to Main Domain Transfer WordPress Site WordPress

Share

Post navigation

Previous: WordPress Zoom Integration | The Top 5 Plugins in 2022
Next: How to Prevent WordPress Website from Hacking with 11 Effective Methods

Free Download

Woo Product Table (Free Version)

Checkout Added to cart

Min Max Quantity & Step Control (Free)

Checkout Added to cart

UltraAddons Elementor (Free)

Checkout Added to cart

Premium Plugins

Woo Product Table Pro

  • Billed once per year until cancelled

  • Billed once per year until cancelled

  • Billed once per year until cancelled

Checkout Added to cart

Min Max Step Control Pro

  • Billed once per year until cancelled

  • Billed once per year until cancelled

  • Billed once per year until cancelled

Checkout Added to cart

Recent Posts

  • Common Mistakes in Software Development and Ways to Avoid Them
  • Top five WordPress Page Builders
  • What is a Woo Product Table?
  • The 7 Principles of Conversion-Centered Landing Page Design
  • Potential analysis of social media channels in relation to the success of customer retention
  • How To Fix Common SSL Issues in WordPress
  • 12 Tips to Create a WordPress Blog
  • Why don’t WordPress Posts not showing on mobile
  • How to Prevent a 504 Gateway Timeout in WordPress
  • How to login into a WordPress site using the phone number
  • How to Show Widgets on Specific Pages in WordPress
  • How do I Fix Mobile Menu in WordPress?
  • How to Delete WordPress Site from Host gator

Categories

  • Advanced Custom Fields
  • Advanced Search
  • Business Idea
  • Custom Fields WooCommerce
  • Custom Taxonomy
  • E-Commerce
  • Errors
  • Featured Tutorial
  • Instant Search
  • Min Mx
  • Multiple Product to Cart
  • News
  • Online Business
  • Personal
  • PHP
  • Plugin
  • Product Variation
  • Programming
  • Quick Buy
  • Theme
  • Tips and Tricks
  • Uncategorized
  • Woo Product Table pro
  • WooCommerce
  • WooCommerce Filter
  • WooCommerce Product Table
  • WooCommerce Product Table Free
  • Wordpress
Trustpilot

Subscribe to our Newsletter

Resources

  • Support
  • Coupons
  • Blog & News
  • Write For Us
  • Video Tutorials
  • Affiliate Program

Company

  • Our Service
  • Get Quote
  • Refund Policy
  • Privacy Policy
  • Support Policy
  • Terms of Service

Powered By

© 2022, CodeAstrology. All Rights Reserved.
  • Privacy Policy
  • Terms of Service
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT