Knowledge Base

< All Topics

How to Move WordPress from a subdirectory

1. In order to move the WordPress from subdirectory to root directory you will need to take the proper backup of your data and databases that you will move to root directory.

2. Update the WordPress site URL: Log in to your WordPress dashboard and navigate to “Settings” > “General.” Update the “WordPress Address (URL)” and “Site Address (URL)” fields to reflect the new root directory location. Remove the subdirectory path from both fields.

3.Log in to your Cpanel account and go to backups and click on full account backups.

4. After taking the backups log in to your Cpanel account  and go to >> files section >> file manager

5. Locate the WordPress files in the subdirectory and move them to the root directory. This involves moving all the files and folders except for the “wp-content” folder.

6. Update the WordPress configuration file: In the root directory, find the “wp-config.php” file and open it using a text editor. Look for the following lines:

define(‘WP_HOME’, ‘http://example.com’);

define(‘WP_SITEURL’, ‘http://example.com’);

Replace the URLs with your new root domain:

define(‘WP_HOME’, ‘http://yourdomain.com’);

define(‘WP_SITEURL’, ‘http://yourdomain.com’);

7.Also, you need to got to Databases >> phpMyAdmin >> Select the database and click on option file.


8.You will need to change the home and site URL link and click on save changes.

Save changes made in the files

7. After moving all the WordPress files to the root directory, you need to move the “wp-content” folder separately. Move the entire “wp-content” folder from the subdirectory to the root directory, ensuring it sits alongside the other WordPress files.

8. Once done visit your website to ensure it’s functioning correctly from the root directory. Verify that all the pages, posts, images, and plugins are working as expected. Test different functionalities, such as submitting forms or interacting with plugins, to ensure everything is functioning as intended.

Categories
Scroll to Top