How to Move WordPress from a Subfolder to the Root Directory

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 move WordPress from a Subfolder to the Root Directory.

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 ( to
  4. Lastly, look for the Site Address address (URL): and change it from ( to

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. Go to Settings In the Preferences window that appears, select the checkbox 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 ( or
  2. Go to Administration -> Settings -> Permalinks and ensure the link structure is the same as your new URL.

Are you interested in unleashing the power of WordPress? Our managed platform for WordPress is fine-tuned to deliver superior performance, security, and provide best-in-class hosting. Be sure to check out our WordPress hosting plans.

124 thoughts on “How to Move WordPress from a Subfolder to the Root Directory

  1. I’m a student and gamer so recently I installeded wordpress at Takenbest Site but after sometimes, I need it to migrate to a sub domain but it showed database error, what should I do.
    I can share its picture with error details but here no option to share photos.

  2. Fantastic instructions
    Thank you
    I did have to install the “Search and Replace” plugin by InfoD74, to fix all of the image and link urls, which worked perfectly as well.

  3. wordpress was setup in
    but I cant find Administration -> Settings -> General.
    Next, look for the WordPress address (URI): and change it from ( to
    Lastly, look for the Site Address address (URL): and change it from ( to

    1. Hello and sorry for your issue. In the WordPress dashboard you’ll see Settings on the left. If you do not see this, you may not have admin rights within that WordPress website.

  4. Fantastic data collection, This is Work perfectly for me. I tried to do it on my site and had no issues. Thanks for sharing with us.

  5. Hello,

    It’s Very usefull to me as I was looking for some tricks to transfer files to the root directory. Searched so many blogs but you guys are amazing on this job, and usally I don’t leave a comment but your article is so good and helpfull that I thought and writing this.

    Again thanks for the simple trick, as I’m not going to use Duplicator plugin no more.

    All the best!

  6. Follow the tutorial step by step and now I have the error message ‘ 

    Briefly unavailable for scheduled maintenance. Check back in a minute.’ on my wordpress site which I was intending to switch to. 

    How do I  fix this?

    1. We would need more information to help you. Please provide details on the issue and we can try to help. You can also contact our live tech support team (contact info at the bottom of the page).

  7. After i have update the wordpress and site URL, how can i go back and reverse it?

    Also, i find something strange is that when i entered the URL, then it redirect to and i manually delete the subdirectory then it’s fine, is there anything or configuration in c-panel that i need to update?

    Also, i do not know what is wrong on the mobile.


    1. You would need to change the settings again with the updated URL to revert it back. We do not block mobile traffic explicitly, so I’m not sure why your phone would not see the site. Can you describe what you’re doing on your phone that is different from the computer? Note that WP does have a default area in the .htaccess file. If changes are made there or re-direct changes are applied above their code OR if another .htaccess file has precedence over the one for your WP site, then it can affect the behavior of the website. Also, if you make changes to the .htaccess file of your WP site then you should always make sure to clear the browser cache before trying to re-load the site in that internet browser.

  8. Hi,

    My url with the sub folder still shows up after i have moved all the files. Also, the site don’t appear in the mobile phone anymore.

    How do i resolve that?


    1. Ensure you have updated your “WordPress address (URL)” and “Site Address address (URL)” as described in the first section above. Also, test with another browser or clear your browser cache before testing.

      Thank you,

  9. I just wanted to let you know that I just did this and it worked beautifully!! Thank you – such a relief. The only hitches I had was links to some media files like pdf or video or audio files which I had to update. But overall, everything moved over like a dream. Thank you!

  10. After doing the above steps, I get the error when I want to access any page

    You don’t have permission to access /test2/index.php on this server.
    Server unable to read htaccess file, denying access to be safe


    Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

    1. I recommend checking your .htaccess files stored on your server, as the error indicates that is the cause of the issue. However, since it does not specify the location of that file, you should check all the .htaccess files.

  11. after doing all steps my wp admin deshboard is open but when i click site they show me your website is under construction how can i fix that?

    1. It sounds like you may have an under construction plugin enabled or an index.html file your browser is defaulting to in your document root, i would recommend disabling any underconstruction plugins and removing any excess index files.

  12. What is the differenc between this method and:

    1. using Softaculous to make a clone in the root

    2. Using WordPress toolkit,  implement Move installation

    3. Using the Duplicator Plugin reccomended by WP Beginner

    Why would you choose one over the other?

    1. The main difference is the guide above does not require a 3rd party plugin installation. But it is really a preference for you, as long as it works!

      Thank you,

    2. i have migrate https to www in phpmyadmin(wp-option). But the images url still pointing to https. How can change that to www? Help me to solve this please. Thanks in advance.

  13. Hello! I have a main domain in my root folder and an addon domain (unrelated to the main domain) as a subfolder in the root. I made a dev subfolder in the addon domain, which is located as another subfolder in the root, alongside the addon itself. I want to move my dev subfolder to the root and delete the addon domain.

    Do I need to take any extra steps in this situation? Will the files for the main domain interfere with the dev subfolder once I move it to the root?

    Thanks so much in advance.


    1. Hello Mila,

      Thanks for the question about moving the dev folder. As long as it’s in the folder, there should be no interference with the other files. You will need to make sure that you change the root location for the subdomain if you have defined it as a subdomain in the cPanel. If not, then you don’t have to worry about it. If you have configurations which rely on the location of the dev folder then you may need to change the location of the folder.

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

      Arnel C.

    2. Hello Mila,

      Thanks for the question about moving your dev folder. No extra steps are necessary. As long as the files remain in the folder then they shouldn’t interfere with anything else. Of course, there shouldn’t be a duplicate of the dev folder – otherwise, you’ll have a naming issue. If you have any configurations relying on the location of the dev folder then you will need to change the location to match where you have moved it.

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

      Arnel C.

  14. Another question:

    Since my WordPress website is currently still under, all the internal links also contain /wordpress/. After I have followed the steps in your tutorial, will all the internal links change to URL’s without /wordpress/?

    1. Hello Aya,

      If you have hard links in a post or page, then you would need to update them. However, anything new will NOT have the subdirectory included in the path. After you have made the change, make sure that you are updating the permalinks in your WordPress installation.

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

      Arnel C.

  15. Hi,

    I’m about to move my new WP website to the root and delete my current website, but I have a question. In my current .htaccess file I have a long list of redirects and this code:


    options +SymLinksIfOwnerMatch

    RewriteEngine on

    RewriteCond %{HTTP_REFERER} !^$

    RewriteCond %{HTTP_REFERER} !^https://(www\.)?example.*(/)?.*$ [NC]

    RewriteRule .*\.(avi|gif|jpg|jpeg|bmp)$ https://www.example.*/ [R,NC]


    Options +FollowSymlinks

    RewriteEngine on

    rewritecond %{http_host} !^www\.example\.nl [nc]

    rewriterule ^(.*)$ https://www\.example\.nl/$1 [r=301,nc]


    (I have changed the name of my domain to ‘example’).


    Now, in the current WordPress directory there is also a .htaccess file, which contains:

    # BEGIN WordPress

    <IfModule mod_rewrite.c>

    RewriteEngine On

    RewriteBase /wordpress/

    RewriteRule ^index\.php$ – [L]

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule . /wordpress/index.php [L]


    # END WordPress


    Do I need to combine the two or is the WordPress htaccess code redundant once I moved the WP website to the root?

  16. Create a file named index.php in your domain root with the following content….


    define(‘WP_USE_THEMES’, true);



    Where Mainsite_New is your WordPress site folder name.





  17.  Great tutorial – worked like a dream. I usually use Duplicator, which is free and also goo but this method is the easiest and fastest I;ve come across.

    Thanks John-Paul! 🙂

  18. hi, want to ask

    if i wanna change my wordpress from to in iis with, is possible or not ?

    anybody have a solution for this ?

    thanks before

  19. Hi,


    I completed all the steps. However if i goto my homepage it still has my hosting providers page saying if you own this please upload to public_hmtl.

    But if i goto that page will come up and so will the others, only the homepage wont?

    1. The intro page may be index.htm or index.html and your first page is index.php. If that is the case, rename the index.htm or html page. This should allow the index.php page to show for your site.

  20. Don’t know if this impacts anybody (perhaps a note in the installation directions) but when I did the conversion try as I might I couldn’t get the wordpress changes to appear.

    It suddenly occurred to me that my existing site uses index.htm andthe wordpress uses index.php.  After renaming my existing index.htm Firefox now brings up my wordpress site. 



  21. Hi , I’m haveing a problem i’m using the cpanel and i can’t get the files to the root and even i tried installing the wordpress direct to the root but it want let me , I tryed even serching on youtube but on nobody has a video ( and support want help me ) so what shoud i do ? i even tried on filezila and it want let me in 

    1. Unfortunately, it is difficult to say since I do not know the access levels of their setup. I do know on our servers, you have access to your files via cPanel File Manager, or FTP.

      Thank you,

  22. Hi.

    I have moved my files from /dev/ to live but the ‘Home’ link on my navigation bar still goes to the dev site. The other links work okay.

    Any ideas what is wrong?



    1. Make sure to check if the Site and Home URL were updated after the move. You can add change this setting in the WordPress General Settings, as mentioned above in the section headed “Prepare your WordPress installation for the move”. You can also add set the Site and Home URL in the wp-config.php file to get the same effect.

  23. could you please explain to me what this error is https://www.**********.com/mobilB/wp-json/oembed/1.0/embed?url=http%3A%2F%2Fwww.**********.com%2FmobilB%2Fstorm-windows%2F and how do i fixed ?
    i let you know that i’ve changed my wordpress url and my website url and directory of my wordpress install from www.******.com/mobilB to www.******.com 

    1. Hello karim,

      Thank you for contacting us. I checked the link you provided, and am just getting a “page does not exist” message.

      Is that the error you are getting?

      If not, can you provide the full error message?

      Best Regards,

  24. Worked perfectly for me. I tried to do it on my site and had no issues. Straightway 100% result.

  25. I am not real fluent on c_Panel or the organization of things so not sure I am following what you are suggesting.  If I follow all the steps in this article down to step 8 and don’t delete subfolder, are you saying I can’t use it as I am now as a development area?  Are you saying instead that I should create another directory  and move the  the WordPress subfolder content to this directory.   Isn’t the subfolder a database.  It shows as a database in c_Panel.  What is in my subfolder is not a subdomain so should I be creating a subdomain and coping my database to there?  


    1. Hello Ken S.

      Sorry for the confusion. First, your database is NOT in a folder on your website. It’s in a separate location on the server. WordPress references the database in wp-config.php. If you have ALL of the necessary files for running WordPress in a subfolder, then you can use that site as long as there is a separate database setup for that site. I test all the time using WordPress subdomain installations. As long as you have all the necessary elements for the WordPress installation to work (the WordPress core files, a wordpress database, and a properly configured wp-config.php file), then it shouldn’t be a problem to use the site as a test site. It doesn’t hurt to have another WordPress site for testing, but it’s not always necessary either. It will be up to your needs. If you have any further questions or comments, please let us know.

      Arnel C.

  26. After coping Wordpress from a subfolder to root is it OK to leave the WordPress subfolder with the original WordPress files and use it as a test or development site?   Will it cause any issues.

    1. Moving a WordPress installation to a different location on your server can definitely cause the site to function differently. However, copying can be harmless if the content is copied to a different directory. If you’re going to use the copied files as your testing site make sure you create a database and database user with the appropriate privileges.

  27. My WordPress Settings/General do not have the WordPress Address and Site Address fields – neither editable nor non-editabe. I tried to definte these variables by hand in the wp-config.php file, but I still get the WP install prefix the same as before. Why would these fields be missing, and how can I reconfigure WP so that it looks in public_html folder, rather than public_html/wp?

    Thank you!

    1. Hello Colin,

      Sorry for the problem with the WordPress and Site address fields. If you’re not seeing the Address and site address fields in General, then it may be either theme or plugin related. Make sure you’re using the latest version of WP, and then make sure to use the default theme and no plugins. If you continue to have the same problem,then I would recommend re-installing WordPress. We would need more information about your installation – URL, version of WP, custom theme/plugins and also the steps (or URL) to see the problem you’re having.

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

      Arnel C.

  28. 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!

  29. 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!

    1. 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

  30. 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 to , imported the new db after dropping all the tables first.

    and still same result.

    I should mention that oddly enough my is still loading properly :-/

    what am i missing here?

    Thank you in advance!

    1. 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

  31. 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.

  32. 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:

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

  33. 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.

    1. 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

    1. 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.

      Arnel C.

  34. 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!!

    1. 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 and not 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!!

    2. 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.

      Arnel C.

    3. 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 /


      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?

    4. 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.

      Arnel C.

    5. 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.

      Arnel C.

    1. 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

    2. Hello PaulaC,

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

      Kindest Regards,
      Scott M

  35. 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

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

  37. 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 or that is giving error

    1. 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.

  38. 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?

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

    Did what I needed – thanks again


  40. 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 ?



    1. 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:


      // ** 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

    2. 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.

    1. 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

  41. 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:

    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.



  42. 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?

    1. 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.

Was this article helpful? Join the conversation!