How to move WordPress from subfolder
This article will take you through the process of moving your WordPress website from subfolder yourdomain.com/wp to domain root – yourdomain.com.
There are three ways to achieve the result:
Re-installation. If you just installed your website and have done no or a little development, re-installation of the WordPress will be the easiest way out.
You just need to go back to cPanel > Software/Services section > Softaculous > WordPress, remove wp from the In Directory field and proceed with the installation.
Do not forget to uninstall /wp website in Softaculous once done.
Redirection. If the website is pretty much done and re-installation is not acceptable, you can setup hidden redirect – the installation will remain in /wp subfolder but your website homepage will be yourdomain.com.
Take into account that this redirect will make /wp disappear only on the homepage, links will still have it – e.g. yourdomain.com/wp/contactus
If it sounds alright for you, add the following redirect to the .htaccess file in domain web root (replacing yourdomain.com with your actual domain name, and wp with your subfolder)
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?yourdomain.com$
RewriteCond %{REQUEST_URI} !(/|\.[^/]*)$
RewriteRule (.*) http://www.yourdomain.com/$1/ [L,R=301]
RewriteCond %{HTTP_HOST} ^(www\.)?yourdomain.com$
RewriteCond %{REQUEST_URI} !^/wp/
RewriteRule ^(.*)$ /wp/$1
File migration and Database update. If the variants above do not work for you and you would like to make sure there is no /wp on your website, you can do with this option.
We highly recommend to backup website files and database before proceeding.
1. Let’s start from file migration.
Either via FTP or File Manager go to your website folder
Select All files > Move them to the domain document root (in our example from public_html/wp to public_html)

Once done, go back to domain document root to make sure all files have been moved
2. Database update
You can update old URL references with the new ones in the database either using search and replace scripts, or using text editors.
Below we provide the guidelines using the latter.
- Check what database is being used for your WordPress website. You can check it in the wp-config.php file located in WordPress installation folder
- Go to cPanel > Databases section > phpMyAdmin
- Select the database in question and click on Export > Go
- The database will be downloaded to your computer. Now you need to open it and update all yourdomain.com/wp references with yourdomain.com.
Once opened, click Ctrl+F and choose tab Replace. Fill out the fields below correspondingly > Replace All
- Once done, the prompt below will display the result
- Save the updated database and exit the application.
- Now go back to cPanel > Databases section > phpMyAdmin and select your database
- Checkmark all tables using the option below and select Drop from the dropdown menu
- On the next page confirm the actions by clicking Yes
- Once the old tables are dropped, go back and select the database > Import

- Choose the updated database from your computer files to upload > Go
- You will see green status bar – this will indicate that database has been successfully imported. On your right database tables tree will appear
This is it!
Go back to your website and refresh the page to check the results.
Need any help? Contact our Helpdesk












