InMotion Hosting Support Center

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. Click here to learn more about WordPress Hosting.

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.
Continued Education in Course WordPress
You are viewing Section 20: 329: Moving your Wordpress from a subfolder to the root directory
Section 19: 330: Finding the Network Administrator Interface for Wordpress MS
Section 21: 328: How to disable comments on new posts and pages in Wordpress

Support Center Login

Social Media Login

   
Social Login Joomla
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
24,685 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
24,685 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?
n/a Points
2015-01-23 3:26 am

Really Awesome  Very Helpful Article ....Thanx...admin

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
16,204 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
11,156 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
11,156 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
27,153 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,968 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
n/a Points
2015-04-06 4:28 pm

I recently moved my WP site from a subdomain/folder to the root. Now I'm wondering how to fix all the old broken links that I previously shared on my social media pages to (at the very least) redirect to my homepage. Thoughts? Thanks.

Staff
16,204 Points
2015-04-06 4:42 pm
Hello Lindsay,

Thank you for your question. I recommend using 301 Redirects to fix the broken links.

If you are not good with coding .htaccess files, it may be easier to use one of the many 3rd party plugins available.

Thank you,
John-Paul
n/a Points
2014-07-31 7:10 am
perfect. saved my life. perhaps explain how to do it with Filezilla rather than c-panel. Just found it a little easier to do it this way.
n/a Points
2014-08-20 5:50 pm
Include steps for multisite installation of wordpress
n/a Points
2014-08-21 9:57 pm

Folks ...Great info, moved without a glitch from subfolder to main domain > www.*****.cn

Did what I needed - thanks again

 

n/a Points
2014-09-09 8:57 am

Nice guide, i moved my site from folder to root, but now no mails sent from wp. Post notifications, registration mails, lost password mail, doesn't send at all. Any idea?

Staff
16,204 Points
2014-09-09 9:50 am
Hello Christ0fer,

Thank you for your question. In our guide on resetting your WP password via PHPmyAdmin, you can also update/view the Admin email.

In Step 5 of that guide, click Edit beside user_email to change it.

Feel free to post any additional questions below.

Thank you,
John-Paul
n/a Points
2014-10-30 5:51 am

nice for wordpress users and fans.

n/a Points
2014-11-12 8:46 am

hi

i've completed everything fine till step 8 and my website is live showing all the wordpress stuff

but the next step where you said login to your new wordpress dashboard

example.com or example.com/wp-admin that is giving error

Staff
24,685 Points
2014-11-12 9:43 am
Hello Syed,

Sorry for the problems with the Wordpress move. In order for us to help you, we need more information, please. If you can provide a URL that we could check, it would help us understand what's happening. It also helps to know if you're using any re-directs, plugins, or directory changes that may have affected the location of the WordPress Administrator. If you're not sure, then you may need to troubleshoot the WordPress plugins, or check the WordPress database for the setting used for the WordPress Administrator.

Please provide us a little more information and we can investigate the issue further.

Kindest regards,
Arnel C.
n/a Points
2014-12-09 1:15 pm

Thanx, Very Helpful Article , Everything is perfect after moving my site to the main root according to the article instructions.

n/a Points
2015-01-24 1:05 pm

I am not sure if I am missing a step in moving my WP files from a sub-directory in the root directory. There is a sentence that says removed the site files from the builder. How is this done? Currently I am at the step of backing up the files. I have not changed the URI or URL names yet

Staff
27,153 Points
2015-01-26 11:35 am
Hello PaulaC,

To remove the builder files, you would simply delete them manually from within the cPanel file manager.

Kindest Regards,
Scott M
n/a Points
2015-01-25 5:45 am
hello im My Site Duniabd.com please unrevome the file directorye at duniabd.com please help me http://duniabd.com
Staff
27,153 Points
2015-01-26 11:28 am
Hello Shimanto,

I am not understanding what you are asking. Could you please respond with what it is you want to do step by step if possible?

Kindest Regards,
Scott M
n/a Points
2015-02-15 4:48 pm

very nice all that artilce , i read all and know what you want to say , and its will help me alot 

n/a Points
2015-02-23 5:46 pm

OK. Here is MY problem. I did everything EXCEPT delete the DEV folder (/test) The index page comes up. But when i click on another link OR try to Login, I get this:

Fatal error: Cannot redeclare jetpack_is_mobile() (previously declared in /home2/seamona/public_html/test/wp-content/plugins/jetpack/class.jetpack-user-agent.php:3) in /home2/seamona/public_html/wp-content/plugins/jetpack/class.jetpack-user-agent.php on line 59

 

Please help!!Everything is Broken now and I cant get it back!!

Staff
27,153 Points
2015-02-23 7:51 pm
Hello Maurice,

Are you able to get into the wp-admin area? Can you disable the plugin? You may need to disable them either in bulk, or using the same technique, disable the individual plugin folder.

Kindest Regards,
Scott M
2015-03-11 2:37 pm
Hi,
I'm not really ease with wp, it's new for me. A quick question for you. I'm just starting the process and first problem when I tried to change the WordPress address (URI) and the Site Address address (URL). My adresses are example.com/test and not example.com/wordpress. I deleted /test at the end of both and when I saved, I received an error message:
Not Found

The requested URL /wp-login.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Any idea to help me? Thanks a lot!!
Staff
24,685 Points
2015-03-11 2:58 pm
Hello Melanie2496,

Thanks for the question. Actually, the error is normal. You're just missing some of the steps required to finish that change. The link following the SITE URL option goes to this tutorial: Giving WordPress Its Own Directory. If you follow the steps here, then it will work properly. Sorry, it's not too obvious in the Administrator - it's something that I wish WordPress would fix myself.

I hope this helps to answer your question, please let us know if you require any further assistance.

Regards,
Arnel C.
2015-03-11 3:19 pm
Hi Arnel,
I ignored the error and continued the steps, but now seems to be worst...
The current website doesn't work, all my folders of wp are writing on the page:
Index of /

license.txt
readme.html
wp-activate.php
wp-blog-header.php
wp-comments-post.php
wp-config-sample.php
wp-config.php
wp-cron.php
wp-links-opml.php
wp-load.php
wp-login.php
wp-mail.php
wp-settings.php
wp-signup.php
wp-trackback.php
xmlrpc.php

When I try to go on the administration of the new website, I have this error message:
Not Found

The requested URL /wp-admin was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

In cpanel (File manager) the former files have been replaced by the new from wordpress but when I go to my FTP nothing changed. Any idea?
Staff
24,685 Points
2015-03-11 3:41 pm
Hello Melanie2496,

It is difficult to determine what you've done based on what you're showing me. If you are an InMotion Hosting customer, can you please provide your domain name. We can look at the account then help you resolve issue you're facing. If you're not a customer of InMotion, then we need to go BACK and look at the steps provided in the WordPress Codec to determine where things went wrong.

Please give us a little information so that we can provide further assistance for this issue.

Regards,
Arnel C.
2015-03-11 3:47 pm
Unfortunately I'm not a customer...
I'm totally lost, how to go back?
Staff
24,685 Points
2015-03-11 3:57 pm
Hello Melanie,

Your best bet is probably simply to reset, remove all of the current files and then re-install WordPress. Otherwise, you will need to backtrack and undo what you've just done. Get back to the point where all you did was change the Site URL. Once you have done that then you can refer back to WordPress's directions. I think that there was some misunderstanding with the directions starting at step 7.

Regards,
Arnel C.
n/a Points
2015-03-25 6:51 am

After moving my website to my hosting server, the theme options won't save.

Staff
24,685 Points
2015-03-26 1:01 pm
Hello Don,

Sorry to hear you're having problems with saving your theme. Can you tell us if you're a customer? And if so, can you please provide the account information? It sounds like a permissions issue, but we can't what the problem is without looking at the account.

If you have any further questions or comments, please let us know.

Regards,
Arnel C.
n/a Points
2015-04-27 7:55 am

Not sure what I have done wrong. I managed to get the website working but the images wouldnt show. I followed Arns information in the comments above

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.

Which seemed easy enough, but when I imported back in to the database I got this error:

Error

 

SQL query:

 

---- Dumping data for table `wp_cb_contact_form`-- INSERT INTO `wp_cb_contact_form` ( `form_id` , `form_name` ) VALUES ( 1, 'Enquiry form' ) ;

 

MySQL said:

#1062 - Duplicate entry '1' for key 'PRIMARY'

 

ANy ideas on how I can fix this, I am not good with databases.

Thnks

Staff
27,153 Points
2015-04-28 9:24 am
Hello Hodgie,

This is due to having data already in the database with that ID. When you export the database, set the Insert Ignore option. This will then add rows even if their ID exists. However it will delete the current ID and give it the next available one in line.

Kindest Regards,
Scott M
n/a Points
2015-05-25 12:13 am

Hi Scott. I fixed the last problem I had importing the sql back, however this time nothing seems to fix it and I am freaking out as I need to get the site up and running today :-/

Im not sure if its the theme that I have used that may be causing the problem.

Can let me know what I am doing wrong please...

SQL query:

 

---- Dumping data for table `wp_commentmeta`-- INSERT INTO `wp_commentmeta` ( `meta_id` , `comment_id` , `meta_key` , `meta_value` ) VALUES ( 1, 1, '_wp_trash_meta_status', 'post-trashed' ) , ( 2, 1, '_wp_trash_meta_time', '1430279887' ) ;

 

MySQL said: Documentation

#1062 - Duplicate entry '1' for key 'PRIMARY'

n/a Points
2015-05-25 12:19 am

Hi Scott, Im not sure what I did, however I seem to have managed to get it to upload properly using your previous comments this time (very strange). So sorry for sending the original query. Thank you for your past help, the tutorial is great to follow.

n/a Points
2015-05-09 3:08 am

Thank you. Its easier than i thought. Vey simply explained and easy to follow.

n/a Points
2015-05-13 4:05 am

informative and easy to follow!

n/a Points
2015-05-29 8:02 am

Hi and thanks for the tutorial...

unfortunately although i followed all the instructions my website is still not showing up. I copied all the files that were in my Test folder into the root (public_html)... after that i checked to see if my site was working, instead i only had a blank page appear... 

i then accesed my db via phpadmin and exported my db, replaced all the urls from mydomain.com/test to mydomain.com , imported the new db after dropping all the tables first.

and still same result.

I should mention that oddly enough my domain.com/test is still loading properly :-/

what am i missing here?

Thank you in advance!

Staff
3,216 Points
2015-05-29 10:01 am
Hello Mark,

Have you tried reverting your theme back to the default 2014 theme? This is usually the cause for blank wordpress installations.

Best Regards,
TJ Edens
n/a Points
2015-06-16 1:01 pm
I (thought) I followed these instructions but am getting a 500 Internal Server Error when I try to go to the site and a 403 Forbidden error when I try to log into the dashboard. Don't know where to begin!
Staff
3,216 Points
2015-06-17 12:23 am
Hello John,

Are you able to see the apache logs? This would provide you with the direct issue regarding the 500 error. Generally the issue comes to either file permissions or something wrong in your .htaccess file.

Best Regards,
TJ Edens
n/a Points
2015-06-18 11:55 am

Hi TJ, Thanks for your response. I did look at the error logs - they say there was a fatal php error on line 80 of my config.php. I am hosting on another server and followed your directions thinking they would work. Not sure how I would see anything wrong on my .htaccess file or on my index.php. Hosting service has been asked to restore files and server to before I attempted the move but it seems like they either don't understand what I'm asking or don't know how to do it or aren't able. I'm sure if I knew just a little more I could untangle this mess!

Staff
16,204 Points
2015-06-18 12:44 pm
Hello John,

Thank you for contacting us. Have you read our full guid eon the 403 Forbidden Error?

It provides additional troubleshooting information on the 403 error.

Thank you,
John-Paul

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.

60 Questions & Comments

Post a comment

Back to first comment | top

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!