How to move WordPress from a subfolder to the root directory

October 14, 2024 / WordPress

When launching our website, we faced the task of moving it from a testing subfolder to the main directory. This common challenge for developers often arises during site development to keep unfinished work hidden.

Below are the steps we followed to move WordPress from a subfolder to the root directory:

  1. Backup Your Site:
    Before making changes, create a backup of your website files using cPanel.
  2. Prepare Your WordPress Installation:
    1. Log into your WordPress dashboard
    2. Go to Settings > General.
      settings
    3. Change the WordPress Address (URL) and Site Address (URL) from example.com/wordpress to example.com
      wordpress url
    4. Click the “Save changes” button.
      save
  3. Move WordPress Files
    1. Log into your cPanel admin dashboard and open File manager. Ensure now Hidden files is checked.
      file manager
    2. Navigate to the subfolder (e.g., public_html/wordpress).
      public_html
    3. Select all WordPress files, click the Copy icon, and set the destination to public_html (remove the /wordpress part).
      copy
    4. Click Copy Files to transfer them.
      copy files
  4. Delete the Old Subfolder
    1. Once the files are copied, navigate back to the public_html folder and confirm the files are present.
    2. Delete the old subfolder (e.g., wordpress).
  5. Finalize URL Details
    1. Log into your new WordPress admin dashboard (e.g., example.com/wp-admin).
    2. Go to Settings > Permalinks and ensure the link structure is updated to reflect the new URL.
      premalink settings

Following these steps allows for a smooth transition of your WordPress site from a subfolder to the root directory.

After migrating your WordPress site, plugins might disappear. Check out our guide on how to fix plugins disappearing from the WordPress dashboard.

Spread the love