How to Move WordPress from Subdirectory to Root
Moving WordPress from a subdirectory to the root directory can improve your website’s URL structure and make it more user-friendly. This guide will walk you through the process step by step.
Sometimes, when you install WordPress using an installer, there’s an option to install WordPress within a specific folder. If you mistakenly enter a folder name and later realize that WordPress has been installed and set up in a subfolder, you’ll need to adjust the settings.
So do not worry , its very easy process to move back under root folder / directory or public_html folder .
before know the process how to Move WordPress from Subdirectory to Root , know why its need to be in root.
Why Move WordPress to the Root Directory?
- Cleaner URLs – Instead of
example.com/subdirectory
, your site will be accessible atexample.com
. - SEO Benefits – Shorter URLs are easier for search engines and users.
- Branding and User Experience – A root URL looks more professional and is easier to remember.
Step-by-Step Guide to Moving WordPress
1. Create a Backup
Before making any changes, back up your entire website, including files and the database, using a plugin like UpdraftPlus a wordpress plugin or manually via control panel .
2. Move WordPress Files to the Root Directory
- Connect to your website using FTP (FileZilla) or File Manager in control panel .
- Navigate to the subdirectory where WordPress is installed.
- Select all files and move them to the root folder (
public_html
or the main directory of your site).

3. Update Site URL in WordPress
- Log in to your WordPress dashboard.
- Go to Settings > General.
- Update both WordPress Address (URL) and Site Address (URL) to your root domain (
https://example.com
). - Save changes (do not refresh the page yet).

If you are unable to log in to WordPress or are experiencing issues updating these URLs, log in to your control panel, go to phpMyAdmin, select your database, navigate to the wp_options
table, and update the siteurl
option.
4. Fix the .htaccess
and index.php
If your website stops working after moving the files, follow these steps:
- Open
index.php
in the root directory. - Look for this line:
require( dirname( __FILE__ ) . '/subdirectory/wp-blog-header.php' );
- Change it to:
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
- Edit the
.htaccess
file in the root folder and update any references to the subdirectory.
5. Update Permalinks
- Go to Settings > Permalinks in your WordPress dashboard.
- Click Save Changes to refresh the URL structure.
6. Update Internal Links and Images
Use a plugin like Better Search Replace to replace old subdirectory links in your database with the root URL.
7. Check and Fix Broken Links
Use a tool like Screaming Frog SEO Spider or an online broken link checker to fix any broken links.
8. Submit Updated Sitemap to Google
Finally, update and submit your sitemap to Google Search Console to ensure search engines properly index your site.
Alternative Method: Using an Installer
Also, you can do this same process via an installer such as Softaculous. Softaculous provides an easy way to clone or move WordPress installations with just a few clicks, making the migration process much simpler for non-technical users.
Conclusion
Moving WordPress from a subdirectory to the root directory is a straightforward process if done correctly. Always back up your site first and double-check all changes to ensure a smooth transition.
Need help? Let us know in the comments!