Many people like to create and test a new version of their site in a subfolder so that it does not affect their main domain. Once completed, they will want to migrate the new site over to the root directory for the domain. This is very common with WordPress. Follow the instructions below as we guide you on how to do just that with the WordPress CMS.

Make a Backup of your account

Before performing the following procedure, it is a good idea to make a backup of your account prior to making any changes. Learn how to make a backup here: Backup website files in cPanel.

Prepare your Wordpress installation for the move

Prior to physically moving the files, you will need to prepare the installation to accept the new URL name.
  1. Log into your WordPress Dashboard. For example.
  2. From the main dashboard, go to Administration -> Settings -> General.
  3. Next, look for the WordPress address (URI): and change it from (example.com/wordpress to example.com)
  4. Lastly, look for the Site Address address (URL): and change it from (example.com/wordpress to example.com)

Moving your Wordpress from a subfolder to your main folder

After you have made your backup, removed the site files from the builder, and prepared your wordpress files, it is time to move your WordPress to the primary folder.
  1. Log into your cPanel admin dashboard.
  2. From the main cpanel area, look for the Files category and then click on the File Manager tool. Ensure you select the checlbox entitled Show Hidden Files.
  3. Once inside the File Manager, you will want to navigate to the folder you have the WordPress site in. For example, a folder named wordpress.
  4. You will see a list of all the wordpress files and folders in the right hand panel. Highlight them all and click on the Copy icon from the menu toolbar across the top of the page.
  5. A popup will appear so you can enter the destination folder. Continuing with our wordpress folder example, it should show as public_html/wordpress. Remove the /wordpress from the destination path so that it simply displays as public_html. Click the Copy Files button.
  6. This will copy the files up to the public_html folder. Use the File Manager to navigate back to the public_html folder. (You can do this by clicking on the Up One Level button from the toolbar across the top of the right hand panel.)
  7. You should now see the same files as you have in your wordpress folder.
  8. You can now delete the old wordpress folder.

Log in and finish the URL details

  1. Log into your NEW WordPress admin dashboard. For example (example.com/wp-admin or example.com/wp-login.php)
  2. Go to Administration -> Settings -> Permalinks and ensure the link structure is the same as your new URL.
Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Like this Article?

Comments

Post a comment
2013-06-13 6:08 pm
Hello, thanks for this tutorial, my WP folder was in domain.com/wordpress, and i already moved to domain.com. Now the only issue is the attachment images, is pointing to domain.com/wordpress, how can i do to change that to point to root? i can't make the step 8 because it will make Error 404.

I'm making some changes to move my websites to Inmotion Hosting Business Pro Plan.

Thanks in advance.
Staff
15,484 Points
2013-06-13 6:32 pm
Hello MnLGmz,

The changes you're needing to make for the content is in the database. The easiest thing for you to do is to actually export the database as an SQL file and then edit it - unless you're familiar with making update queries in SQL. I'll list the steps below for what you need to do to make the change using the export option (it's much easier):

1) Login to your Cpanel
2) Go to PHPMYADMIN
3) Select your Wordpress database
4) EXPORT your Wordpress database as a SQL file. Make a copy and keep it as a backup.
5) Download the SQL file that was exported to your local computer.
6) The SQL file is a text file, so you can open it in something like notepad, and then run a FIND AND REPLACE. You will need to look for your OLD PATH and replace it with the NEW PATH. The Find and Replace function is built into the editor.
7)When you're finished, save the file. Don't change it to another file format - keep it as a .SQL file.
8)Upload it back to the server.
9)IMPORT the changed file back into your server using the PHPMYADMIN.

And that should change the path in the database for you! I hope this helps you with your problem. If you have any further questions or need further assistance, please let us know!

Regards,
Arnel C.
2013-06-13 6:45 pm
Hello,

Thanks for answer very quick. Is there any way to find this path making a search in phpMyAdmin?, its a little bit tricky for me, because i don't have knowledge with this.

Thanks in advance,
Staff
15,484 Points
2013-06-13 6:50 pm
Hello MnLGmz,

You can try going through each table one by one and then looking at the data. You would need to go through all of the tables that have the path and then making the change manually. Otherwise, you need to use an update query using MySQL. If you're not familiar with using MySQL, then follow the steps I have listed, and you will be able to make the change to the database very easily.

Regards,
Arnel C.
2013-07-29 11:52 pm
Followed everything you mentioned here but still see the old site that was initially present in the root and do not see the wordpress site that was initially present in a subfolder - wordpressdev.
Do i have to remove the old files under root?
2013-07-30 12:07 am
I have done the phpadmin step also but still see the old site on the root domain, need your help
2013-07-30 12:15 am
Alright, I had to delete all files under public_html and upload the wordpress files, looks like that works!
2013-07-30 12:24 am
Another question, how to save wordpress theme options?
Staff
7,266 Points
2013-07-30 10:23 am
Hello aviator,

Thank you for contacting us. I am not exactly sure what your question is, but if you are customizing a theme, we have a guide here on using the Theme Customizer.

We also have a helpful guide on installing a new theme in Wordpress.

These articles are all part of our Wordpress Education Channel.

If you have any further questions, feel free to post them below.
Thank you,

-John-Paul
2013-09-13 9:03 am
The best way to clean your MySQL DB after you move from dev. to production is to install a plugin called
WP Migrate db http://wordpress.org/plugins/wp-migrate-db/
It will search and replace all your directories in all locations, files, posts, tables, etc.
I've used it for my sites I've developed and once I get my site onlin, will post a link, recommend, and donate to them.

Mike
2013-09-14 9:32 pm
/*** Update ***. I gave the wrong plugin above.
Use this one http://www.velvetblues.com/web-development-blog/wordpress-plugin-update-urls/
velvet blue works great to update your url before and after your move-

Mike
2013-09-21 4:09 pm
I am to "Step 8: You can now delete the old wordpress folder" but it won't let me.

I would like to simply rename it (instead of deleting it), but I get an access denied error, as if it's locked or still "running". I've tried via FTP and through an online interface. FYI, I have an IIS installation.

Is there something I can do to "unlock" this folder (or disable the old wordpress) so I can rename the folder?

Any help is greatly appreciated!

Staff
7,372 Points
2013-09-23 9:01 am
You may have some sort of permissions issue that is not allowing you to make changes to the file. Unfortunately, I don't have much knowledge of IIS as we only run Linux servers but either your hosting provider for the IIS server or Microsoft may be able to provide you with more information on the issue.
n/a Points
2014-03-15 3:09 pm

http://wordpress.org/plugins/velvet-blues-update-urls/ it will be helpful.

n/a Points
2014-03-16 7:19 am

Just another reason that Wordpress sucks badly. The other one WP being totally incapable of doing complete exports with images, templates and everything. With this much software bloat, why couldn't anybody make WP easily movable, backupable and restorable?

Staff
7,372 Points
2014-03-17 9:16 am
Most CMSs, such as WordPress, Joomla, and Drupal will define your URL within it. This causes the additional changes to be made and is not something that is specific to WordPress.
n/a Points
2014-06-11 6:08 am

Hi,

This a very useful article/tutorial, but I guess that there are other alternatives to the “manual” migration process.

I’ve seen several plugins like Duplicator that can help you migrate from server to server.

I’ve also developed another plugin for this, it’s a complete solution:

http://codecanyon.net/item/wp-golive/7793291?ref=RedhopIT

GoLive plugin has a lot of features:

Automatically Export the Database from Source Server Transfering the files via FTP automatically Auto-import Database in Remote/destination server. Update .Htaccess properly Update wp-config.php file on destination server with the new credentials. Replace the URLs in Database (Posts, Pages, Menus…), and keep auto-update serialized objects too.

I hope it helps someone.

 

Regards,

n/a Points
2014-06-12 4:48 pm

I just install it to my root directory of <http://odosta.com>ODosta</a> but I cannot cannot change my image path to root directory. please tell me how I can do it.

Staff
15,308 Points
2014-06-12 5:00 pm
Hello Ahsan,

Do you have specific images that you are referring to? The images that I checked on your site have paths starting from the home directory.

Kindest Regards,
Scott M
n/a Points
2014-07-05 1:18 pm

I followed this tutorial and the WP site is coming up fine, and can log in like normal so all is well EXCEPT the theme colors and background has changed back to default. So that didnt "move" with everything or something changed it.

I still have the subfolder with good design - but I cant log into that anymore either.

How do I get the theme, custom css, colors, skin to move to the root directory ?

Thanks!

Paul

Staff
9,521 Points
2014-07-06 3:26 am
Hey Paul,

Were you sure to copy everything from your /public_html/wordpress directory to just /public_html?

It also sounds like you could need to change the WordPress URL of your site if you forgot to change it prior to copying your WordPress site from a sub-folder to the root of your site.

A quick way to check is to place this highlighted code in your wp-config.php file:

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

// ** MySQL settings - You can get this info from your web host ** //



That should force things to load from the proper URL, as it's usually a bad link to a CSS stylesheet that causes display issues after moving. If that fixes it, follow the other steps from that guide to make it permanent and remove the settings from your wp-config.php file.

If that's not the problem, you might also have issues with content directly stored in the WordPress database using the sub-folder URL. In phpMyAdmin you could simply click on the Search tab and look for subfolder-name with at least one of the words and clicking on Select All and then Go.

Please let us know if none of that does the trick for you.

- Jacob

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

News / Announcements

WordPress wp-login.php brute force attack
Updated 2014-07-17 06:43 pm EST
Hits: 201636

Related Questions

Here are a few questions related to this article that our customers have asked:
Moving your Wordpress from a subfolder to subfolder
Putting WP site in specific directory + moving to root directory later
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!