Moving WordPress from Sub-Directory to Root Directory

Moving WordPress from Sub-Directory to Root Directory

In my blog article How can I transfer WordPress from a subdirectory to the root directory I outline an approach where you don’t need to move your WordPress installation physically, but you could make a few configuration adjustments to make the URLs of posts and pages appear from the root, moving away from the WordPress application and the uploaded content inside the subdirectory. This is a good option when you wish to maintain a clean directory structure and avoid having to write numerous URLs, as well as not having to deal with shifting a lot of files around on your server.

But, you might not be able to make use of the subdirectory any longer and instead wish to transfer WordPress out of the subdirectory into the root directory. Here are the steps for doing this.

(Tip TIP: Instead of using the procedure described below, you can utilize this Duplicator plugin for creating an archive file of the whole site and then restore the archive within the directory that is in its root. The advantage that comes with using the Duplicator plugin is the fact that it automatically rewrites each of the pages’ URLs to your site. However, duplicates of a large website could be cumbersome, and the process of archiving might not be a good fit on certain websites that are prone to slow down when creating huge archives.

Prior to migrating WordPress from the subdirectory directory to the root directory.

1. Ensure that you are logged into your hosting control panel as well as File Manager in the control panel and also access phpMyAdmin in case you have to change the changes you make to the WordPress General Settings section below.

2. Make a back to your database using the UpdraftPlus as well as the BackWPUp plugin. Download this file and store it securely.

3. Eliminate any files that were created on your old website out of the main directory and move them into a _backup folder. This would include an index.html file that will cause this to fail. It is imperative to remove all old folders and files or move them to another directory to ensure that they do not affect WordPress. The presence of the files index.html, index.html, and index.php within the same folder can confuse. Index.html will likely be used instead of index.html will be used in place of WordPress’ index.php file;

4. Be sure not to have any additional folders in the root directory with similar names to web pages you have on your WordPress website, such as “blog,” unless, of course, that’s the name of the subdirectory installation that is part of WordPress where you can’t have a website with identical name as the browser might become confused and seek this page in the folder. Then, things get extremely confusing.

5 – If you’re using a caching plugin, remove the cached pages and deactivate caching.

The move of WordPress installation from a subdirectory into the public_html directory

1. Click Settings > General, and remove the subdirectory in the URL for each WordPress Address and the Site Address. Make sure you remove the trailing. Both addresses should be able to end in .com and .org or whatever the type of domain is. Click Save Changes.

2. Using FTP or the File Manager on your website host, You will have to transfer all WordPress documents from your subdirectories to one level and then to the root directory.

To accomplish this using FTP and FTP, go to the remote server section. You can toggle the subdirectory containing the WordPress installation you want to transfer. Please choose all the files that are in this directory and drag them out of the guide to the public_html directory or another directory it is located within.

If you’re making use of the File Manager in the control panel of your web host:

– Double-click on the subdirectory that contains WordPress files. WordPress files.

Choose Select All in order to choose all files.

– Click Move File.

– – In the Move dialog box, delete the subdirectory from the path field. This will mean that the path you’re shifting to is /public_html.

(Note Note: Some hosts could have another designation for this directory, or you might have installed WordPress in a subdirectory within another directory. Remove the subdirectory you are currently in from the path and the forward slash, /, but don’t take anything other than the forward slash.)

– Click Move Files.

The files must be transferred into the web_html public_html.

3. 3 – Login to WordPress within the root directory. This should be your domain’s name and the suffix /wp-admin. e.g.

4. Navigate to Settings, then Permalinks, and select Save Changes. This will modify your .htaccess file to delete the subdirectory from the URLs of your pages.

5. 5. Install 5 – Install the Velvet Blues Update URLs plugin.

When you go to Tools > Update URLs, type in the URL of the website that contains the subdirectory within the old URL field. Type the site without the subdirectory in the new URL field.

Make sure you do not close the URLs using forward slash /. If you end the URL with a forward slash, finish it by using a forward slash to complete all URLs, not only one. It is crucial to be consistent here.

Be sure not to change all GUIDs. This can cause themes to have their settings reset and posts to be republished on an RSS feed.

6 6 Select the update URLs option. This should capture the majority of the URLs found on the website. If you find it difficult to miss a few URLs, try repeating this procedure without the HTTP”://” in the URL and see whether it picks up more.

7 – Look for any other URLs that are not spotted by the Velvet Blues plugin. Velvet Blues plugin including:

Menus > AppearanceLook to see if there is a custom URL that links to the old URL on any menu item that you can customize, for example, the link to the home page.

Application > Appearance Options or the theme’s Options page. Check the URLs for uploaded files like Favicon, logo, and the like, and remove the subdirectory from URLs if necessary.

SlidersIf you’re using Revolution Slider or another slider plugin, it may not be updated to change your URLs to the slider images using Velvet Blues. Velvet Blues plugin. Edit the slider and delete the subdirectory of any URLs for photos.

Shortcodes and custom layouts Some shortcodes used for buttons or custom layouts could contain URLs to subdirectories that could require you to change manually. If you are able to identify a pattern in these, attempt to run this Velvet Blues plugin again using the URL pattern you discover.

8. Test the website to ensure that all is working as expected.

9. Reset the cache and update the .htaccess file according to the instructions for caching plugins according to the requirements. Check the site once more in an alternative browser to be certain that the pages are cached correctly.

10 – Last but not least, to ensure that you don’t lose the SEO credit you earned on the old website, You should create a wildcard redirecting the URL from your old one to your current one. To do this, add the following code at the end of your .htaccess file by using your File Manager or FTP application, replacing your domain’s name with a subdirectory name. (Note: .htaccess is an invisible file. It would help if you chose your File Manager (or FTP client to display hidden files to view the file.)

RewriteEngine On

RewriteCond % ^$ [OR]

RewriteCond % ^$

RewriteRule (. *)$$1 [R=301,L]

In the RewriteRule line, use www or do not use it depending on what you’ve got in the General Settings section of your Settings. For example, if you don’t have www included in your URL under General Settings, do not include the www in your RewriteRule line.


  1. Before you begin with this rule, set it at 302 rather than 301.
  2. Verify that it works using a URL that has the subdirectory inside and verify that it is rewriting to the same URL with no subdirectory.
  3. If you’re certain it’s working, switch the 302 number to the 301.

302 is considered to be temporary and not utilized for SEO or cached in browsers. 302 is considered to be an ongoing change and is used as a permanent change by Google to transfer SEO credits of a page between one website and the next, as well as being cached by the browsers.



Leave a Reply