How to move your WordPress from a sub-directory to root folder?

What is the need of moving WordPress from Sub-directory to Root folder?

Sometimes by mistake you have install your WordPress to WP folder/sub-directory. In this case your website will be visible at But if anyone search your website at the will show an error message. So to make your website visible without sub-directory you need to move your WordPress at the root folder.

How to move your WordPress from a sub-directory to root folder?

To move your WordPress from sub directory to root folder you need to follow the following steps:

Step1: Login to your cPanel.

Step2: Scroll down to the Files section and click on "File Manager".

Step3: Now click on "public_html" folder at the left side of the panel. A list of files & folders will open.

Step4: Open "WP/sub-directory" folder from the list in which you have installed WordPress and Select .htaccess & index.php file then click on "Copy" icon at the top navigation bar.

Step5: A dialog box will appear. In the dialog box remove the sub-directory and keep here public_html only. Then click on "Copy File(s)" button.

Step6: Navigate to public_html root folder and "edit" copied index.php file.

Step7: After Finding require( dirname( __FILE__ ) and replacing '/wp-blog-header.php' ); with '/yoursubdirectoryname/wp-blog-header.php' ); click on "save" button.

Step8: Now go to Home page of your cPanel.

Step9: Scroll down to Database section and click on "phpMyAdmin".

Step10: Click on Database of your website, which you want to move to root folder. A list of files & folders will apprear.

Step11: Click on "yoursub-directory_option" from the list of folders.

Step12: Click on "Edit" link in the 2nd row.

Step13: Remove yoursub-directoryname from the URL and Click on "Go" button.

Now your website's URL has been changed from to