WordPress GuideDevelopment → Moving Subfolder To Root Directory

How to move your WordPress from a subfolder to the root directory

Starting your WordPress site in a subfolder is a smart way to test or build quietly. But when you’re ready to go live, you’ll want it to show up at your main domain—without the subfolder.

Let’s walk through how to move your WordPress installation from a subfolder to the root directory, safely and step by step.

Get fast, reliable hosting for WordPress

Power your site with the industry’s fastest, most optimized WordPress hosting

Overview: how to move WordPress from a subfolder to the root

To move WordPress from a subfolder to the root directory, follow these steps:

Each step is crucial for keeping your site functional and error-free.

Why move WordPress from a subfolder to root?

Here’s why you might want to move your site:

Whatever your reason, making this move the right way keeps your site safe and smooth.

Step 1: back up your WordPress site

Always start with a full backup. Mistakes can happen, and this gives you a safety net.

You’ll want to back up two things:

Easiest backup method (plugin)

Use a free plugin like UpdraftPlus or All-in-One WP Migration to back up both files and the database. These plugins also let you download backups to your computer or cloud storage.

Manual backup method

Once you’ve saved both the files and the database, you’re ready to move on.

Step 2: move WordPress files to the root directory

Now you need to move your WordPress files from the subfolder (e.g., /wordpress) to the root directory (e.g., /public_html).

There are two common ways to do this: File Manager or FTP.

Option 1: Using File Manager (cPanel or hosting dashboard)

Option 2: Using FTP (File Transfer Protocol)

Tip: Do not delete anything from the subfolder yet. You’ll test the site first to make sure the move worked correctly.

Step 3: update the WordPress site URL

Once your files are in place, you need to update the site’s URL settings so WordPress knows it lives at the root now.

Method A: Update via WordPress dashboard

If you can still access your dashboard:

This might log you out or break the admin panel temporarily—that’s normal after a move. Just proceed with the next steps.

Step 4: edit wp-config.php (if you can’t access the dashboard)

If your dashboard is unavailable after the move, you can hardcode the new URLs directly.

This forces WordPress to use the new root URL, bypassing the settings page.

Step 5: update the database (site URL and internal links)

Even after changing the site address, the database might still include old subfolder references—especially in links and media files.

Update siteurl and home in the database

Update old URLs across content

To fix media links, menu items, and other internal references:

This step ensures your entire site now points to the correct root URLs.

Step 6: regenerate permalinks and fix .htaccess

You’ll want to make sure your permalinks and redirects are refreshed to reflect the new structure.

Regenerate permalinks

This triggers WordPress to rebuild your .htaccess file and fix link routing.

Check .htaccess manually

If you had custom rules or if permalinks aren’t working:

Optional: remove the old subfolder

Once your site is fully functional from the root directory:

This step is optional, but it helps clean up your site’s file structure and avoid confusion later.

Common issues after moving WordPress

1. Broken links or missing media

This usually means some internal links still point to the old subfolder. Re-run the Better Search Replace plugin and clear your browser cache.

2. Styles and scripts not loading

Often caused by:

Clear your cache and double-check your site URL settings.

3. 404 errors on pages

If clicking on posts or pages gives you a “Page Not Found” error:

4. Login redirects to old subfolder

This can happen if you missed updating the database or hardcoded settings. Make sure both the wp-config.php and wp_options table reflect the root URL.

Alternatives to manual migration

Use a plugin (easiest for beginners)

Plugins can automate many of these steps:

Make sure to follow plugin instructions closely and always test after migration.

Hire a professional

If your site is large, complex, or business-critical, consider a professional migration service. They’ll handle file movement, database cleanup, and testing, which can save time and avoid downtime.

Ready to get started?

Get the fastest, most secure WordPress.org hosting on the market.

Additional resources

What is managed WordPress hosting? →

Get details and decide if managed WordPress hosting is right for you.

WordPress development agency guide: What they do, when to hire one, and how to choose →

Discover what WordPress development agencies do, when to hire one, and how to choose the right partner for your website project.










A complete guide to WordPress shortcodes →

Shortcodes make life easier. Learn how to get started!

Trust us to help you choose the ideal hosting solution

Loading form…