How do I move WordPress from a subdirectory to the root directory?

Q. I’ve installed my website in a subdirectory of our domain, because I didn’t want visitors to see the site until I was finished with our development.

Now I want to have the site show up in the root directory (not in the directory). How do I do this? I’ve read the information on moving WordPress, and it seems really complicated.

A. The good news is that you DO NOT need to MOVE WordPress in order to have your content display without the subdirectory name. You only need to move 1 file and change one line of code and make one modification to your General Settings, and you’re good to go (see instructions below).

Installing WordPress in a subdirectory can be a good idea because:

  • It keeps your root directory clean and tidy (in case you need to add any other PHP applications to your site).
  • It adds a layer of security through obscurity by obscuring the location of your WordPress application files. Ideally, you want to name the subdirectory something not too obvious (ie don’t call it wp or WordPress). I’m not sure how obscure this really makes WordPress, because you can obviously get the subdirectory name from any images uploaded to the site, since they will still read as, so I usually install WP in a subdirectory for development purposes or to simply keep the root directory clean in case I install any subdomains or other applications.
  • It allows you to develop a new WordPress site while maintaining your current website in the root directory. Once you’re finished with your WordPress development, you can backup and then delete your current site’s files, and use the following instructions to display WordPress from the root directory of the site.

Note: If this is an older site, you will need to create 301 redirects to redirect your old page/post URLs to the new page/post URLs. Also, if you have a lot of internal hyperlinks, you will need to manually update those.

Before attempting to move WordPress

a) Clear ALL pages cached by your caching plugin cache AND then de-activate the caching plugin. Also, de-activate Broken Link Checker and any Redirection plugins;

b) Remove any old site files from the root directory — perhaps copy them to a folder called _backup – this includes an index.html file which will totally make this process not work. You MUST remove all those old site files and folders or move them into another directory, so they don’t interfere with WordPress. Having an index.html and index.php in the same folder causes confusion, and likely, the index.html will be used instead of WordPress’ index.php file;

c) Make sure you don’t have any other folders in the root directory that have the same name as any pages on your WordPress site, for example “blog” unless of course this is the name of your subdirectory install of WordPress in which case you cannot have a page of the same name because the browser will get confused and look for that page in that folder, then things are really confused;

d) Use wp-db-backup to make a backup of your database –;

e) Be sure you have access to your database via phpMyAdmin on your web host’s control panel in case you type the URLs wrong in the next step. Your database username and password are in the wp-config.php file.

Displaying WordPress URLs from root directory when WordPress is installed in a sub directory

1. Login to the WordPress Dashboard. From the Settings -> General tab, set your WordPress address URL to the subdirectory you installed WordPress in (without the trailing slash). Note: This will already be displayed in the WordPress address field, so you don’t have to change it. What you do need to change is the Site address URL. Set this to  your site’s root address (without the trailing slash).

2. Using an FTP application or your web host’s File Manager, DOWNLOAD the index.php file that is in the WordPress application directory (not the one in your theme’s folder or elsewhere) and then UPLOAD the copy you downloaded to the root directory. (By root, I mean the www, htdocs, or httpdocs folder — NOT the root of your hosting account! You simply want to upload the copy of the index.php file and put it in the parent folder of your subdirectory which presumably is the location for the main URL of your website.)

Alternately, you can use your FTP application and MOVE the index.php “to the parent” but then you MUST read and follow step 6 below.

(Note: If you have a site already in the root directory, such as an old static html site, then you should backup and delete those files first.)

3. In a text or HTML editor, open the index.php file that you just copied and/or moved to the root (aka main url) directory and change the location of your wp-blog-header.php to tell WordPress where it can find the WordPress application files in the subdirectory:

Example: if your WordPress installation folder is ‘mywp’, you would change:

require( dirname( __FILE__ ) . '/wp-blog-header.php' );


require( dirname( __FILE__ ) . '/mywp/wp-blog-header.php' );

Important: Be sure you type this correctly! A missing / or too many slashes or missing period or apostrophe can make this not work. Believe me, I’ve seen people be totally freaked out things didn’t work and it was because they typed this line wrong.

4. Visit the site and click an interior page to make sure it displays correctly. If it doesn’t, you may need to update your permalinks (Settings -> Permalinks and click Save Changes). If you still cannot access your interior pages, then the .htaccess may need to be moved to the same location as the index.php file (i.e. the root directory). This is not necessary on all web hosts. Be sure to update the permalinks again after you move the .htaccess file.

Remember that your login and registration links will still be

Now, when people visit your site, they will see all the URLs of all the pages and posts as if you had installed WordPress in the root directory, and you will have a neat WordPress directory behind the scenes.

Note: If the site you are redirecting to the root previously was your live site, and you have a lot of posts whose URLs you do not want to change, then you should change your Permalink structure to INCLUDE the old subdirectory name (e.g. mywp), so none of your post hyperlinks break. For example:


The /mywp/ will only be in the URL of the posts, not the pages.

5. Create a “Silence is Golden” index.php file in the WordPress directory.

If you copied the index.php file instead of moved it, this step is optional. Essentially, you don’t “need” this duplicate index.php file in the subdirectory because it doesn’t really do anything other than prevent people from reading the directory contents. However, if you moved the index.php file leaving the WP directory without an index.php file, then you should create a new blank index.php file and put the following code in the file:

[php]<!–?php // Silence is golden. ?–>[/php]


If you have any trouble with this process, please visit my Moving WordPress from Subdirectory to Root FAQ.


If this process was successful, please comment with a thumbs UP below, share on Twitter, follow me on Facebook. Thanks!!!

Angela Bowman

Front-end WordPress developer since 2007 building highly custom websites for nonprofits and small businesses. Experienced in nonprofit administration, grant writing, and technical writing. Love high altitude hiking and backyard chickens.

View all posts by Angela Bowman

957 comments on “How do I move WordPress from a subdirectory to the root directory?

  1. Hey Angela, great site. Great post. Still, I’m having problems :/

    My host is, first time I’ve ever used them. When I install WP I am forced (for some reason) to install into a directory and not the root, so only loads when the install is done and just loads to an under construction page. I’ve deleted and re-installed WP multiple times in the last couple days trying fix this issue to ensure there are no other factors causing problems. I feel like I’m real close to fixing this since finding your post, but it’s still not working. When I go to the htdocs folder in my host’s file manager the only thing there is the install directory (wp1) and the index.php that I just moved there as per this post. Should there be more files in the htdocs folder? I feel like something’s missing. Thanks.

    • I had that issue with some hosts, and it’s just a drag. The only way to get around this issue is to do a manual install following the manual installation instructions at My instructions won’t work in this case, because the host is pointing the WordPress installation to that subdirectory, thus thwarting all your attempts to show it from the root. I see this most often with Network Solutions installations. So, maybe that’s a sign to use a different host.

      • Hi Angela. I am having this issue right now where the client’s hosting company will not allow me to install WordPress on the root level… it is forcing me to install into a subdirectory. I even tried manually installing files on the root via FTP and it all failed.

        Do you know why some hosting providers prohibit this? I want my client to switch hosting companies but they are resisting because they think there is nothing wrong with them and are quite annoyed at the prospect of having to set up a new account somewhere. (Hard to explain techie stuff like this to a client and make them understand :/ ya’ know the feeling I’m sure)

        Is there any way around this? I have clled the current hosting company’s tech support and no one there is even halfway experienced with using wordpress, they have been no help at all.

        • I have seen Network Solutions do this, and it creates a big problem when trying to run WordPress in the root or switching from the subdirectory to the root. If a host will not accommodate WordPress being installed where you need/want it, they are not a good host and are likely to not support WordPress well in general. The way around this is to do the install yourself and not rely on the autoinstaller provided by the host. You will need to follow the instructions at:

  2. Hi Angela,

    I have recently used the duplicator plugin to go from one host to another. The domain remains the same. I created a new folder in the destination host’s public_html”

    When I run the duplicator in the subdirectory the site is now “”
    I would like it to be “”

    To follow your steps, you require index.php to be copied to the root. What if there is already an index.php there? What if I want to have multiple sites on this host, I cannot have an index.php sitting in the root for 5 different websites.

    On bluehost, I have various domains running from sub directories, however as they were all fresh installs i never had to go through any of this. They all run fine from a subdirectory with no need to change the wordpress admin site address or wordpresss site url settings in.


    • If there already is an index.php file in the root, then check to see what subfolder it is pointing to or what exactly is in that file. It’s possible, the index file is simply there to prevent directory searching of your root folder.

      With most hosting situations, the root folder is reserved for the primary domain. All other domains are installed and pointing to subdirectories, so their index files would typically never display in the root directory. The only index file in the root will be a plaeholder index file to prevent directory listings or the index file for the main domain.

  3. What if my wp is on a subdomain, like What changes should i make to

    require( dirname( __FILE__ ) . ‘/wp-blog-header.php’ );

    • If you install your site in a subdomain, you cannot use my directions for moving it to the root. You need to following the instructions from for actually MOVING the WP install to your root (aka public_html) folder.

  4. You are the best!! Just had a nightmare trying to move my site up to the root folder then saw this article and it all suddenly worked. Thank you!!!

  5. Thanks Angela! I was so scared to move my new site. I spent days “reading” about it all over the web but was scared to actually do it. I followed your instructions (they were by far the clearest I have found) as best I could understand and it went off without a hitch. I especially appreciated you posting the code of the exact index.php file I needed. I found 2 before the right one. The hugest “PHEW!” I have ever sighed!

    One question, since it was originally an html/css site I was going to follow step 6 and make the “silence is golden” index.php file and put it in the wp folder, but it was already there. It was one of the 2 index.php I found when I was looking for the correct one. Why was it already there?

    Thanks again!

    • Hi Susan,

      If people move the index.php out of the subfolder, then you definitely want a Silence is Golden index.php. But, if there is already one there, if for example you copied the index.php file, then you don’t need another one as long as everything fine, and when you visit the site/subfolder you don’t see a directory listing.

  6. I made the mistake of using the subdirectory /wordpress and should have used a less obvious subdirectory as you said. Is there a way of changing the subdirectory?

    Also, my current permalink settings are set to Post Name: so if I change to Custom Structure: new subdirectory)/%postname% – are they the same thing that return the nice title url?

    Thanks for all your guidance- especially reading through all the comments/questions and your help in answering. Mike

  7. Hi Angela,

    Great post, been searching the web for something like this. A couple of questions if I may..:

    – does this method work for WordPress sites running Woocommerce
    – I’m assuming if I don’t enable permalinks on my Dev site and then enable them on my Live site, that I have just made the move a little bit easier?

    • I don’t know how friendly WooCommerce is to running in a subdirectory. Theoretically, it should work, but it depends on how WooCommerce refers to the WordPress URL versus the site URL. I’ve seen many themes and plugins that are written incorrectly and use the site URL when they should use the install URL and vice versa. What I would do is test it. Set up a dev environment in a subdirectory of a URL. For testing purposes, you might have to set up a subdomain, such as and install WordPress inside of

      With your site in the wootest subdirectory, add some products, etc., to your WooCommerce site. Then, follow my instructions to have the page and post URLs for the site display at Then, try adding products, purchasing, etc. If it works, great! If it doesn’t, you can check with the WooCommerce folks.

      I always enable the permalinks. The permalinks are often necessary for things to work well, though, yes, it saves you step, but also requires you create any internal hyperlinks using the un-SEO friendly ugly URLs. It’s just not that big a deal to update your permalinks after this process by going to Settings > Permalinks and clicking Save Changes.

      • Thanks for the reply Angela, I’ll test it and see and report back..

        One thing though – if Woocommerce references the site URL and WordPress URL the wrong way around, could I get around that by changing them both to the root domain and then moving all the files + folders from my sub-directory?

        • Yes, but all of the URLs to the product images, etc., will be using the subdirectory. You could use the Velvet Blues URLs plugin to rewrite all of these. Hopefully it will catch them all. Again, I’d test and be sure you are comfortable with what it will take to move it all. I often use BackupBuddy plugin for this.

          • thanks for the plugin tips, not starting my woocommerce site for a couple of weeks yet, so will report back the results then

  8. Thank-you, Angela!
    You put english on the Codex’s anti-human wording!
    I followed your instructions and the index page changed to the root address perfectly but the interior pages still had my /andi subdirectory attached. I continued reading your helpful instructions and went in and clicked the Save Changes in the permalinks area and voila! All the pages have now lost the /andi bit. So thanks so much.


    Two questions!

    1. Why did simply clicking SAVE CHANGES on the permalinks page (without changing anything on that page) fix the links (remove the /andi subdirectory from the address bar)?

    2. the codex says you need to move the .htaccess file to the root. You say you might have to move the .htaccess file to the root. Where is the .htaccess file if i need to do this in the future for another page? And is that what clicking the Save Changes button on the permalinks page does for you (if it works) such that you only need to move the .htaccess file manually if clicking the Save Changes button doesn’t do that?

    Thanks for making what could have been a nightmare, painless!
    ps. this was my first wordpress page. 🙂

    • Hi Andi,

      Great question. The reason why clicking Save Changes will rewrite the URLs is because WordPress uses the mod rewrite directive on the Apache server to turn the ugly urls with the page ID in it to the “pretty” urls. To do this, WordPress uses the .htaccess file to communicate with the server how exactly to rewrite the URLs based on the settings on the Permalinks page. The general .htaccess command looks like this:

      # BEGIN WordPress

      RewriteEngine On
      RewriteBase /
      RewriteRule ^index\.php$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]

      # END WordPress

      If you installed WordPress in a subdirectory, then the .htaccess file might contain the subdirectory name in the rewrite rule. Clicking Save Changes on the Permalinks page after making the other changes per my post instructions forces WordPress to rewrite the .htaccess file.

      .htaccess is a powerful file that can be used to perform a variety of server-level functions – such as blocking access to users, directories, files, etc. There may be multiple .htaccess files on the server in different directories that do different things. However, .htaccess is top-level down, so anything done in the top level .htaccess file will trickle down to subdirectories. If you install WP in a subdirectory to start with, the .htaccess will be in the subdirectory because that is the only place WP knows exists as far as that install is concerned. When you move your index.php file to the root, then the .htaccess in the root directory can and will be used. Sometimes it still works from the subdirectory location, but, yes, it’s best to have it at the root and remove it from the subdirectory, so you don’t have conflicts between the two.

      I hope that helps explain things.

      • Holy, Angela. A great answer. I understand why clicking the update button for Permalinks rewrites the .htaccess file (even though I didn’t understand all of the coding language). It seems, in language us unfortunate non-geeks can understand, it goes like this:

        WordPress tells the .htaccess file to give your post URLs pretty post name endings (drop the long nonsense endings). When you click the Permalink Save Changes button, if we’ve followed your other instructions, the .htaccess file moves to its new home in the top level root directory. Since the top .htaccess file is the commander-in-chief, all other .htaccess files follow his command. And if by chance there is a belligerent .htaccess file underneath, it might be necessary to remove it.


  9. I love you!!! Thank you so much for all the help. After days of trying to figure this out thank God I found you. For some reason the side bars on some of the pages are not working but those are easy to redo when I thought I had to redo the whole thing all over. Thanks again and may the happiness that you bring to others may return to you 1000 fold 🙂

  10. Hi Angela,
    Great post, and very helpful. Still I have one doubt. I’m currently converting an old html site to a wordpress site. WordPress runs in a subdirectory. So I’m busy writing post etc and sometimes making hyperlinks in a post to another post. These links have the subdirectory in them ofcourse.. Only these don’t get changed when I change my permalinks to the root. How do I solve this?

    I hope you know what I mean, my english is not that good. To explain better, my wordpress runs in
    Now I make 2 posts. In the 2nd post I wirte some text with a link to post one
    Now my site is finished and I ‘move’ my site to and update the permalinks. The permalink of de post will now be The problem is that the link in the text of post 2 still point to resulting in a 404
    Whith a few posts is possible to edit this manually, but in my case there will be many. How to solve this? I now how I can work around this problem in .htaccess, but there must be a nicer solutions.., right?

    Best regards,

    • I understand what you are saying.

      I use a plugin called Search and Replace. Search on the CONTENT field using this plugin like this:

      a href=”
      a href=”

      This will replace all those internal hyerplinks you made to have the correct link when you “move” the site from to

  11. Hey everyone Im working on a project to set up a server at my home I do use a hosting company for my main site this is just a toy project for me to get educated at this time so im using a win 7 home premium computer XAMPP 1.8.2 ( the XAMPP 1.8.3 seems to not work for windows) this pack contains
    •Apache 2.4.4
    •MySQL 5.5.32
    •PHP 5.4.19
    •phpMyAdmin 4.0.4
    •FileZilla FTP Server 0.9.41
    •Tomcat 7.0.42 (with mod_proxy_ajp as connector)
    •Strawberry Perl Portable
    •XAMPP Control Panel 3.2.1 (from hackattack142)
    I also installed bitnami for xamp that contains a word press modual (its inbeded in the installer not sure the version)
    so I have 2 questions:
    1: after getting everything installed and set up it seemed that everything was working ok till I set a user account and password and now it wont let me log back in it (rejects the username and password) and also when it loads it comes up with an error saying,

    syntax error configuration files could not be read, then says to check box for errors but none ever appear:

    however that’s not allways the case if it does not show the error it lets me log in strange (thinking maybe a cache issue or something)

    here is the file

    2: is since im using windows and most use Linux or unix is there a compatibility issue here with word press? I would love to find some better windows info as most post are of course referring to the other systems any good spots for windows users?

  12. I’ve bookmarked this page and referred back to it a few times when launching various WP sites. Just wanted to let you know how simple and useful this explanation is – much appreciated! 🙂 Cheers!

    • Thanks! Glad that the instructions for “moving” your WordPress URLs from the subdirectory to the root worked!

    • If you do this process, then the posts will be referenced from the root of the site. If you want to keep “blog” in the URL to avoid broken links, you can add the word blog to your permalink structure like this after you follow my instructions on this post:


    • Is there any way to re-enable the toolbar for admin while running the site from a subdirectory? I like to browse and edit the site with the toolbar at the top, but it obviously stopped working when we updated the index file.

      • Hi David,

        Yes!!! You just need to clear your browser cache and/or make sure any caching plugin you have installed has all its cached files cleared.

  13. Good morning,

    I’m actually having the exact same issue as Rob. The multi-site installation for WordPress version 3.6.1 does not provide a field for WordPress address. As far as I can tell, the multi-site version is also the source of Super Admin (which translates as Network Admin when logged in, and allows you to install multiple sites and access them from the same interface).

    Logged in both as admin (which is network level access) and a separate user I created with administrator rights, when you go to Settings > General, the listed options available on that page, are as follows:

    Site Title
    Email Address
    Date Format
    TIme Format
    Week Starts On

    The only place I’ve found where the WordPress address is even visible, is when logged in at Network level (My Sites > Network Admin > Sites), and the field in question cannot be edited.

    So I went the long way around and followed the steps (that I could), in the sub-directory to root FAQ. And voila, if I use the root address, it loads the index.php. And that is where the success ended. I also am unable to have the permalinks re-written to disclude the sub-directory.

    Moral of the story, it would appear that enough changed in the multi-site installation version of WordPress, to create complications for this process.

    (Of note, I’ve been trying to get this to work, on a test installation of the multi-site version. If you’d like to see what it looks like, this lab version is established solely for that reason. It isn’t a production environment.)

    • Hi Laura,

      That is good to know you are running multi-site. Multisite cannot be installed in a subdirectory then displayed from the root. This is specified in the documentation for multi-site. It must run in a root directory (or the directory where it will be run from), and all the sites need to be built according to the multi-site instructions. Thank you for letting me know that that is why those URL fields are missing. So, yes, my instructions are not applicable with multi-site installations and trying to do subdirectory installs redirected to the root with multi-site installs will not work, obviously, because you can can’t change these settings.


      • I have installed as multi-site as well, so this explains not being able to see the URL in General settings. I used Installatron in cPanel to do the installation, and under its Files & Tables tab it has a modifiable Location URL. It also lists the WP files, directories and db tables that are associated with the install. Would changing the subdirectory here be a substitute for step 2 in your instructions?

  14. Hi Angela

    I would like to move a WordPress site out of a subdirectory using the technique outlined above, but when I go to the Settings -> General tab of the site Dashboard there does not appear to be any option to set the WordPress address URL. I am logged in as Super Admin, and am using WordPress 3.6.1.

    Could you please tell me if I am looking in the wrong place, or if I might be able to do this in another way?

    • Hi Rob,

      I don’t know about the role “Super Admin” that isn’t being administered via some other WordPress plugin. There is only “Admin.” I’m curious about your installation of WordPress. It doesn’t sound like a typical installation. I’d have to see what your seeing in order to troubleshoot further. You could send screenshots to me if you contact me via the About page of my website.

      The other way to change the Site Address is to do this via phpMyAdmin which I have documented on this post:

      • Hi Angela

        I have just made the site go live using Installatron. It was unbelievably easy, all I had to do was to use Installatron’s Clone function to copy the file from the subdirectory to root. Installatron managed all of the internal link updates seamlessly. I’m not sure whether it is possible to retrospectively use it on a site that was not originally installed through Installatron though.

        • Yes, you can do the same thing with other plugins like BackupBuddy. BackupBuddy has a script that will rewrite all the necessary URLs on the site without messing up any theme options, etc., which is what you generally worry about in doing any sort of global search and replace. However, I do like installing WP in a subdirectory on purpose for the sake of keeping the root directory clean in case other sites are installed on the same account, and the process is much quicker. Thanks for sharing about Installatron.

  15. Hi
    Thank u so much for this great information. I did move my site to a subdirectory and i think i messed all my links and i can’t login to WordPress anymore to fix the main link in general. Please advise me what should i do in this case? the website is and it looks messed up. Thank u for taking the time to help me.

  16. Hello Angela,
    Am using wordpress, am getting some problem while changing the permalinks the website will be crashing can you tell me the other option to change the permalinks.

    • Wow. I’ve never experienced WordPress crashing when changing the permalinks. What is your website? I’m not sure how to help you without logging in and seeing the problem. You can contact me via my About page on this website.

  17. Angela-
    I have successfully redirected my photography wordpress test site from the subdirectory to the main url but now the NextGen Pro plugin is not recognizing the correct path to the images… all the galleries have broken file paths.

    WHen I go into each individual gallery, the images are all there but the path is showing the original url instead of the subdirectory url they are actually in. The field is not editable either, so I can’t update it… also cannot find any documentation on Next Gen site!

    Do you have any experience in changing the path to the images in each individual gallery?

    This is the PRO version, but I uninstalled the PRO plugin from the test site, re-downloaded another plugin from my member area, then re-installed the PRO plugin on the real site url. The galleries are still not recognizing the correct paths to the images.

    I’ve put in a support ticket to NextGen, but thought you might have done this before.

    • Hi Jennifer,

      Wow! That’s a new one on me. I think the way the new NextGEN Gallery is working, it might be generating a code that does not update automatically when the site changes. The new way it’s handling galleries is kind of confusing.

      I’d be happy to help you at no charge, because I teach a class on NextGEN Gallery and would like to help you troubleshoot this issue. Please contact me via my about page on this site and send me a message with your WordPress login. I’m hoping it’s a quick fix.


    • Hi Jen, There is a field in the NextGEN settings to the wp-content folder, so perhaps that value needs to be changed to include the subdirectory in the path.

  18. Hi Angela, I am making a wordpress theme page (a paid one). the thing is I installed everything in a sub domain, ( how can I put it in the root folder and make everything to work ??? can it be done? thank you

    • Hi Heidi,

      The problem with this set up is that you put it in a subdomain instead of a subdirectory. What I would do is use the plugin called BackupBuddy to backup the full site, then copy the backup zip into the main directory along with BackupBuddy’s importbuddy.php file. You will need to create a new blank database in your website control panel and take note of the database name, database username, and password, then use that when your run the importbuddy.php script. It’s really pretty easy. Let me know if you get stuck. If you purchase BackupBuddy, and you do a lot of installations of WordPress, it’s worth getting the developer’s license:

      This is my affiliate link. If you use that, I’d be happy to help you with the migration.

    • The alternative to using BackupBuddy plugin is the following:

      1 – Change the Settings > General to the domain name you want to use, eg

      2 – Move all of the files to the public_html directory for

      3 – You should be able to view the home page and login to WordPress at this point.

      4 – Go to Settings > Permalinks and update the permalinks – this will write a new .htaccess file if needed

      5 – Install the Search and Replace plugin. ONLY search on the website CONTENT, NOT ALL FIELDS. You’ll want to replace:


      This will rewrite any internal hyperlinks and links to images in the posts and pages.

      If this is a premium theme or you have widgets with links or images, you may need to manually adjust those to use the new domain name.

      Let me know if that works for you.

  19. Thank you, this was very helpful. However, now when I visit the web page, I do not see the WP admin tool bar at the top when on a web page. I have to manually type in the sub directory to edit that page. Is there a way around that?

    • Hi Dajad,

      This is a caching issue. If you are using a caching plugin, be sure to delete the cache entirely. Also, delete your browser cache. The tool bar will reappear.

  20. I followed all your instructions.
    The problem is “wp-admin”.
    My old domain was then change it to and it’s working. Everything in the frontend is working except wp-login.php and all the wp-admin links.

    i can only access the admin by using and if i try it redirects to

    HELP, please because it’s stressing me so much. I can’t find answers on the web –

    • Hi Jennifer,

      This is not a problem. This is the way it is supposed to work. Of course, the login will redirect to the demo folder because the WordPress application is in the demo folder. Remember, this process only moved the index.php file and left the WordPress installation in the demo folder. So, the wp-admin folder is inside the demo folder as it should be. The login will always display with demo in the url. Nothing is wrong with that and it will stay that way.


  21. Hi there! I have successfully installed my WordPress site in a subdirectory and made the changes so that users can enter the root url and see my site. I love this setup, however I no longer see an admin panel at the top of each page when I am scrolling through the site, which is a pain b/c I love using the “edit this post” feature and others when I find things that need updates. Have you seen this issue before and do you have any tips for fixing it?

    • Hi Ashley,

      That is very strange. You might try deleting your browser cache or see if you have caching enabled via a caching plugin and delete the cache and see if that fixes the problem.


        • I suspected that! Good sleuthing! Caching is always a problem with this process, because of the obvious reasons that caching creates problems when you suddenly change everything, but the old pages are all cached.

  22. Angela,
    Thanks for the post it helped me migrate everything correctly, and now my pages open up just fine under…, and not

    I have an issue though…. how do i create a page in wordpress that has the same name as a subdirectory in my ftp? I was hoping this wasnt an issue but might have to re-do a lot of work if i am not able.


    • Hi Fred,

      Yes, this is an issue, because WordPress won’t be able to resolve the URL properly. You can certainly have a page the same name but use a different slug. For example, if the page needs to be called “blog,” you can have the slug (url) be something like the-blog, our-blog, my-blog, blog-page.

      Does that make sense?

      If you decide to rename the subdirectory, there are a few things you’ll need to do which are similar to what you would have to do if you had physically moved the entire WP install to the root. Here’s what you would need to do:

      1 – Change the WordPress Address URL (Settings > General) to use the new subdirectory name. Click Save Changes. You will be booted out of the WordPress Dashboard.

      2 – Using your File Manager or FTP application, change the name of the folder to use the new name.

      3 – Edit the index.php file in the root directory to use this new folder name.

      4 – Now, you should be able to login to the site via

      5 – You will need to use the Search & Replace plugin to search the CONTENTS of the pages/posts (not the full search and replace which can cause a lot of problems) to replace the old URL with the new URL — this is primarily to fix links to images within the posts and pages. You might have other internal hyperlinks you need to fix or plugins or widget areas that reference the old directory you’ll need to edit.

  23. Hi Angela,
    Great article… very helpful, I have runned into a problem here

    I noticed that in your instructions you have noted that :

    “c) making sure you don’t have any other folders in the root directory that have the same name as any pages on your WordPress site, for example “blog” unless of course this is the name of your subdirectory install of WordPress in which case you cannot have a page of the same name because the browser will get confused and look for that page in that folder, then things are really confused;”

    how can go around this… i need 2 folders to be a part of site structure, as they contain archive files such as PDFs and images and are a key part of our site which users will need to access.

    Therefore, using my permalinks, i had my site be:

    and have created pages and post to access some PDFs stored in a folder called newsletters in our ftp server.


    this was not an issue before the switch… how do i fix this? i want the post/pages to keep the same structure as the folders on my ftp site.

    Thanks in advance for the help

    • If you have a page called newsletters, you cannot have a folder called newsletters. A simple fix would be to change the slug for the newsletters page to be our-newsletters or all-newsletters or simply news.

  24. Worked like a charm! I have my blog at Banahosting and I had to upload the htaccess to the root directory. Hope that helps to somebody else! Thanks for this post!

  25. Hi Angela,

    My wordpress site is hosted using an Apache instance of EC2. Ive followed your instructions but now I cannot log into the admin site, nor is any CSS applied.

    Please help!

    my site is: (you can see what I mean)

    Thanks in advance!

    • Sorry for the late response. Please contact me via my contact form if you are still stuck. It’s hard to troubleshoot via the URL alone. I would definitely check the FAQ page for this process on my site to make sure you edited everything correctly. It could be a simple typo.

  26. Great information. Maybe I’m over complicating this, but specifically I want to create the new WordPress site in a folder in the main host directory where all my other sites are located.

    Example: < All my sites are here in sub folders for each site.

    And I’ll also be pointing the clients url from an existing site on another server and that URL is

    I have Googled this specifically and can not find anything that explains just this type of change up using WP.

    Thank you

    • With hosting other domains on the same hosting account, the main public_html folder usually has the main web domain associated with the hosting account pointed to it, so whatever is in the public_html folder is usually the contents of that main domain’s site.

      For my hosting account with Host Gator, for example, my main domain is I have the following in my public_html folder:

      index.php – this is the index file related to the WP installation below

      angelabowmandesigns – this is a folder I have my WP site installed in but the domain really is pointed to the root public_html folder since this is the main domain for my hosting account. – this is a folder with my WP installation, and that domain points to this folder as an “add on” domain – this is a folder with my WP installation, and that domain points to this folder as an “add on” domain

      So, I think what you are trying to figure out is the between an “add on” domain whose site files reside in a subdirectory of your public_html folder and simply installations of WordPress that are installed in subfolders of some other site, such as (with someothersite being a subfolder also in the public_html folder)

      If you have developed a temporary site inside a subdirectory on your hosting account and then you need to “move” that site to it’s final location, then you might want to use a plugin like BackupBuddy that will assit with the migration and rewrite all of the URLs for you from the temp URLs to the actual URLs. I have an affiliate account with the makers of Backup Buddy plugin:

      Let me know if you have other questions. I know it’s confusing when you’re first untangling all this and figuring out what the differences are between parked, add-on, subdomains and subfolders. It does take some experience to differentiate between all of these. Then, when you get into creating “development environments” and needing to “migrate” the site, and that’s a bear. I’d love to write a post on site migration from one URL to another. has a good post:

  27. Thanks so much for these clear directions. It really helps to follow them, rather than just breeze through as I just did and screw up the siteurl settings. I was able to work through my issues by editing my functions.php file in the child theme via ftp, adding the following (and inserting the proper addresses for “”:


    Once I could get in again, I corrected the addresses in the settings panel, then deleted the update_option lines from the functions file (which override the dashboard settings otherwise).

  28. Hi Angela

    I’ve been struggling with this for a couple of days now and have tried all the different solutions to no avail.

    My wordpress is hosted in its own directory on an EC2 instance with an elastic IP. Everything was working fine till I was accessing the WP admin through the elastic IP.

    I have a domain name that I have re-directed to the WP directory like so -> http://elasticIP/wpdir. Now, the website works fine for the most part through but I’m unable to access WP admin through it.

    I have already created a copy of index.php in the /var/www/html folder pointing to the wp-blog-header.php file. I also have a .htaccess file with this content inside (I don’t use pretty permalinks now)

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(www.)?$
    RewriteRule ^(/)?$ wpdir [L]

    What do I need to change to make WP admin work via the domain name? My WP and Site URL currently points to the elastic IP and not the domain name. Appreciate any help.

    • Angela-
      I have successfully redirected my photography wordpress test site from the subdirectory to the main url but now the NextGen Pro plugin is not recognizing the correct path to the images… all the galleries have broken file paths.

      WHen I go into each individual gallery, the images are all there but the path is showing the original url instead of the subdirectory url they are actually in. The field is not editable either, so I can’t update it… also cannot find any documentation on Next Gen site!

      Do you have any experience in changing the path to the images in each individual gallery?

      This is the PRO version, but I uninstalled the PRO plugin from the test site, re-downloaded another plugin from my member area, then re-installed the PRO plugin on the real site url. The galleries are still not recognizing the correct paths to the images.

      I’ve put in a support ticket to NextGen, but thought you might have done this before.

    • Hi,

      If the category name is the same as the subfolder name, that can cause some problems. To remedy, you can change the slug for the category to something like our-blog.

      Let me know the name of the subfolder.

      Thanks for writing,


    • Perhaps the WordPress files are not installed in the correct location. If you need more help, please email me via my About page.

  29. Hi Angela,

    First of all, thank you for this awesome post (I’ve bookmarked it for future reference).

    The problem I’m having is that I have 3 WP installations in different subdirectories, within the same hosting account. If I copy the index.html file from subdirectory #2 to the root, it would replace the one from the first site (which was already “moved” and is working fine). How can I make this work for the second, third, etc. sites without breaking the first site?

    Please help!

    Thank you

    • Yes, that is a problem when you have three WP installs on the same hosting account, so how you manage this depends on what each of the installations is for. You certainly don’t want ALL of the installations to represent the content for the one site that is the main domain for the account. In my case, I have the index.php file for the main site in the root directory, and all of my other domains are in their own directories and don’t require or need for me to move their index.php file to the root for any reason. What is in your three installations? Why do you have them? Are they for different websites? If they are for different domain names, then, of course, you don’t need to move their index.php file to the root for any reason, because the root only relates to one domain and not to the others.

      • Thank you for responding. I have 3 different websites, each with their own domain and each installed in different subdirectories, for development purposes. I followed the steps for the first site and everything worked fine. What I’d like to do is have the the other 2 sites show “” instead of “”?

        Really appreciate your help

        • Sorry, I meant:

          Site 1 – “” instead of “”, and
          Site 2 – “” instead of “”

          • If the other domains are all installed in their own folder, and inside that is yet another folder, you can follow my instructions and move the index.php file up one level only to have the site urls display from the folder for that domain instead of from the subfolder. Does that make sense? You can contact me directly via my about page if you need more help to troubleshoot.

  30. Many thanks for your instruction on how to make Wp on the root of a site, clear and simple and worked perfectly. Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *