Back to Community

How to Move Your WordPress Site from a Subdomain to a Subdirectory

22 threads Sep 16, 2025 CoreNetworking wordpress

Content

Moving a WordPress site from a subdomain (like blog.yoursite.com) to a subdirectory (like yoursite.com/blog) is a common request. Users often do this to improve SEO, create a cleaner URL structure, or consolidate their web presence. However, the process involves more than just changing a setting; it requires moving files and updating the database.

Why Would You Want to Do This?

The primary motivation is usually search engine optimization. Search engines like Google may treat subdomains as separate entities from the main domain. By moving content into a subdirectory, all the SEO value is consolidated under your main domain, which can help your overall search rankings. It also creates a more unified experience for your visitors.

Common Challenges and Misconceptions

Based on community discussions, a frequent point of confusion is the difference between a subdomain and a subdirectory.

  • Subdomain: blog.yoursite.com (treated like a separate site)
  • Subdirectory: yoursite.com/blog (part of the main site)

Another major challenge is that you cannot run a subdirectory's path (e.g., yoursite.com/blog) on a completely different server than the main site without advanced server configuration like proxying. This is a technical limitation of how web servers and DNS work.

Step-by-Step Guide to Moving from a Subdomain to a Subdirectory

Warning: Always create a complete backup of your website's files and database before attempting any of these steps. This is your safety net if anything goes wrong.

Method 1: The Standard Manual Method

  1. Create the Subdirectory: On your server, in the root directory of your main website (often public_html or www), create a new folder. For this example, we'll call it blog.
  2. Move WordPress Files: Move all files and folders from your subdomain's directory (e.g., the root for blog.yoursite.com) into the new blog folder you just created.
  3. Update the Site URL: This is the most critical step. You must tell WordPress its new address. You can do this by accessing your database via a tool like phpMyAdmin and editing the wp_options table (for a standard site) or the relevant wp_#_options table (for a Multisite network). Change the siteurl and home values from http://blog.yoursite.com to http://yoursite.com/blog.
  4. Update .htaccess (if needed): You may need to update your rewrite rules in the .htaccess file to ensure permalinks work correctly from the new location.
  5. Reconfigure Your Subdomain: Finally, in your hosting provider's control panel (e.g., cPanel), you can remove or redirect the old subdomain so that visitors to blog.yoursite.com are sent to yoursite.com/blog.

Method 2: Using a Migration Plugin (For Simpler Cases)

For a single site (not a Multisite network), you can sometimes use a plugin like "All-in-One WP Migration." The process would be:

  1. Install the plugin on your subdomain site.
  2. Export a full backup file.
  3. Install a fresh WordPress installation in the subdirectory on your main site (yoursite.com/blog).
  4. Install the same plugin on this fresh install and import the backup file from your subdomain.
  5. The plugin should handle the search-and-replace operation for the URLs during the import process.

Important Note for Multisite: The process is significantly more complex for WordPress Multisite installations. Moving a site within a network often requires specialized tools or manual database SQL queries. It is highly recommended to seek guidance from your hosting provider's support team for Multisite migrations.

What to Do After the Move

  • Thoroughly test every page, post, and image on your new subdirectory URL.
  • Set up 301 redirects from the old subdomain URLs to the new subdirectory URLs. This is crucial for preserving your hard-earned SEO rankings and ensuring visitors don't encounter broken links.
  • Update any internal links within your content that point to the old subdomain address.
  • Submit your updated sitemap to Google Search Console.

When to Ask Your Host for Help

If your hosting provider has a specific tool for creating subdomains (like the "WordPress options" in Hostinger mentioned in one thread), the process of reversing it might also be specific to their platform. If you are unsure about any step, especially involving the database or server configuration, contacting your hosting provider's support is the best course of action. They can often assist with the file movement and DNS changes.

Related Support Threads Support