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?
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
Before making any changes, it’s crucial to back up your entire website, including:
Backing Up Your WordPress Files
– Access Your Website via FTP
- Download an FTP Client: If you haven’t already, download an FTP client like FileZilla.
- 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
- Select All Files: Highlight all files and folders in your WordPress directory (including
wp-content
,wp-admin
, andwp-includes
). - 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
- Log into Your Hosting Control Panel: This is often cPanel or a similar interface.
- Find phpMyAdmin: Look for the phpMyAdmin icon and click on it to access your databases.
– Select Your Database
- 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
- Click on Export: Once your database is selected, click the “Export” tab at the top of the page.
- Choose Export Method: Select the “Quick” export method and the format as “SQL.”
- 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.
– 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:
- Access Your Hosting Control Panel: This is often cPanel or a custom dashboard provided by your host.
- 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:
- Find the Nameservers: Your hosting provider will provide nameservers (e.g.,
ns1.yourhosting.com
). - Log in to Your Domain Registrar: Navigate to the DNS settings or nameservers section.
- Update Nameservers: Replace the existing nameservers with those provided by your hosting provider.
- 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:
- Access the Control Panel: Look for the WordPress installer (often under “Softaculous” or “Install WordPress”).
- Select Your Domain: Choose your root domain for the installation.
- Fill in the Details: Provide your site title, admin username, password, and email.
- 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:
- Check for Free SSL: Many hosts provide free SSL through Let’s Encrypt.
- Install SSL: Follow your host’s instructions to enable SSL for your domain.
- Force HTTPS: Update your
.htaccess
file or use a plugin to redirect all traffic to HTTPS.
– Set Up Basic Settings
Once WordPress is installed:
- Log in to Your WordPress Dashboard: Visit
https://example.com/wp-admin
. - Configure General Settings: Go to Settings > General and ensure your site title and tagline are set.
- Set Permalinks: Navigate to Settings > Permalinks and choose a URL structure (e.g., Post name).
– Install a Theme and Essential Plugins
- Choose a Theme: Go to Appearance > Themes to select or upload a theme.
- 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
- Download and Install an FTP Client: If you don’t have one, consider using FileZilla.
- Connect to Your Server:
- Open your FTP client.
- Enter your FTP credentials (host, username, password, port) provided by your hosting provider.
- Click “Connect.”
- Navigate to Your Subdomain Directory:
- Locate the directory for your subdomain (e.g.,
subdomain.example.com
).
- Locate the directory for your subdomain (e.g.,
Using File Manager
- Log in to Your Hosting Control Panel: Go to your hosting provider’s dashboard.
- Open File Manager: Look for an option labeled “File Manager” or similar.
- Navigate to the Subdomain Directory: Find and open the directory for your subdomain.
– Download Files from the Subdomain
Using FTP Client
- Select All Files: Highlight all files and folders in your subdomain directory.
- 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
- Select All Files: Highlight all files and folders in the subdomain directory.
- 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
- Navigate to Your Root Directory: Once connected to your server, find the root directory (often
public_html
orwww
). - 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
- Navigate to the Root Directory: Open the root directory.
- 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.
- Check File Structure: Ensure that the folder structure matches what you had in your subdomain.
- Confirm Key Files: Make sure essential files like
wp-config.php
,.htaccess
, and folders likewp-content
,wp-admin
, andwp-includes
are present.
– Set Permissions (if necessary)
Sometimes, file permissions may need to be adjusted after transferring files.
- Select Files/Folders: In your FTP client or file manager, select the files and folders you’ve just uploaded.
- Change Permissions: Set folders to
755
and files to644
to ensure proper access and security.
Step 4: Update the Database
- Access phpMyAdmin: Log in to your hosting control panel and access phpMyAdmin.
- Modify
wp_options
Table:- Locate the
wp_options
table (prefix may vary). - Update the
siteurl
andhome
URLs to reflect your root domain (e.g.,https://yourrootdomain.com
).
- Locate the
- 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
.
- Search for
Step 5: Update the wp-config.php
File
- Open the File: Right-click on
wp-config.php
and select the option to edit. - 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. - 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
Step 6: Check Permalinks
- Log into WordPress: Access your WordPress dashboard at the root domain.
- 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
- Check Functionality: Visit your root domain and check that everything is functioning correctly, including links, images, and functionality.
- 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:
- Add Redirects: Use a
.htaccess
file in your subdomain directory to redirect traffic:apacheRewriteEngine On RewriteCond %{HTTP_HOST} ^subdomain\.yourdomain\.com [NC] RewriteRule ^(.*)$ https://yourrootdomain.com/$1 [L,R=301]
Step 9: Update Google Search Console and Analytics
- Google Search Console: Add your root domain and submit a change of address to inform Google of the move.
- 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!
- How to place menu items in helix joomla 5 ? - December 14, 2024
- How to reduce the size of helix 2 layout ? - December 14, 2024
- What’s J4 starter template and how to use it - December 3, 2024
Recent Comments