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 is good idea because:

  1. It keeps your root directory clean and tidy (in case you need to add any other PHP applications to your site).
  2. It adds another layer of security 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.
  3. 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.

“Moving” WordPress from Subdirectory to the Site’s Root Directory

1. Install WordPress as you normally would, but instead of installing it in the root directory (ie in the www or public_html directory), install it in a subdirectory in the www or public_html folder.


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.

2. Once you’ve completed your design work, adding pages to the site, etc., 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).

3. Next, 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.)

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

<?php require('./wp-blog-header.php'); ?>


<?php require('./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.

5. 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, e.g. from to http://www.yoursite.compost-title/ 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.

6. 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 // Silence is golden. ?-->

A Note About Using Cforms if WordPress is Installed in a Subdirectory

If you are using Cforms contact form plugin for WordPress, you will need to tell the Cforms javascript that Cforms is in a subdirectory. You’ll want to do this BEFORE you activate the Cforms plugin. created a good post about how to do this:

Telling Cforms JS that WordPress is installed in a subdirectory

A Note About Web Hosting

If you have a current site with a non-WordPress friendly host, you may want to set up hosting with a WordPress friendly hosting company and move your current site’s files to the new host and then install WordPress as instructed above.


If you have any trouble with this process, please visit my FAQ at:

Please comment on that page.


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

Leave a Reply

  1. An update for you because I got it all to work!

    Oddly enough it absolutely IS possible to create a static blog page with the slug /blog even when your WP install resides in a folder called /blog. There is no clash! I wasn’t expecting this (as I gather you weren’t either!) but I tested it on a test site yesterday and pushed it to my site this morning.

    My site is now switched over so you can see that this does work. My WP install is in the folder /blog but you can view the site on

    I then created a page with the slug of /blog and set that in the reading settings as the static posts page. Visible at

    I then added /blog to the permalink structure and everything works perfectly! All my image SEO is preserved and all my blog backlinks work as well as any previous back links that went directly to

    Amazing! Thanks for your help while I tried to figure all this out.

    • Yay! I’m so glad you tried that, and it worked!!! I thought I had tried it in the past, and it did weird things. The way permalinks are handled has changed for the better in recent versions of WordPress, so that is great news!!! I’ll write up something for the FAQ page on using this solution as an answer for preserving SEO on sites that have a nice URL (like blog) but just want their static pages to show up without the /blog in them. Thanks!

  2. Thank you so much for the post, I’m going to work in a personal website and I was looking for the way to do it in the background, without visitors seeing the process. :)

    • Hi, you can do this a couple ways:

      1 – If there is an existing site, install WordPress in a subdirectory and install a “Coming Soon” or “Under Construction” plugin to make sure no one can see the site.

      2 – If there is no existing site, then install WordPress in the main public_html directory and install a “Coming Soon” or “Under Construction” plugin to make sure no one can see the site.

      When you are ready to go live, if you have installed the site in a subdirectory, you can follow my instructions at and turn off the “Coming Soon” or “Under Construction” plugin. If you installed in the public_html directory, then you just need to turn off the “Coming Soon” or “Under Construction” plugin

  3. If your previous blog was a love one and it was , once you have moved the site to the root, what will people actually see if they then go to

    I understand adding the folder name to the permalink to keep all the blog post URLs the same as they used to be, but I’m really curious about what would happen to backlink that go directly to ?

    • All live blogs are loved blogs, aren’t they. ;-)

      Once you do the process I describe, you will no longer see the posts at – if you add /blog/ to the permalink custom structure, then the posts (not pages) will have the word /blog/ preceeding the post slug, and therefore will not be broken. However, going directly to will result in a 404 not found page. You can create a page called “blog” and assign that via Reading Settings as your default posts page.

      • Thanks Angela! What would happen if I created a page called blog and then set that as the posts page in the reading section? Would this cause a clash since my files are still residing in a folder called /blog as well?

        • The other option would be to physically MOVE the WordPress installation to the root then do wildcard redirect of all the /blog/ URLs to the root URL. Then, hopefully, you wouldn’t looks your Google ranking for your images as they would all have 301 redirects to the correct images. How long has your site been up?

        • (am posting the next reply up here because for some reason I can’t get the “Reply” button to appear on your last comment)

          The site has been up for about 7 or 8 years I think, and amassed millions of page views and a lot of back links, hence my cautious approach to this move.

          What about this:

          1. I MOVE the entire site to the root. Then I add /blog/ to the permalink structure to keep all the posts back links working correctly (I’d prefer future blog posts to contain /blog as well so that’s fine)

          2. I guess that if I did this, the links to images within my posts would still point to /blog/wp-content/…. so that’s fine… I won’t loose any ranking on those images. (I think this is true and that the links in the posts are not relative to the specified site root?)

          3. I delete everything else from inside the /blog directory, apart from the wp-content/uploads directory which contains all my previous images.

          4. I create a new page called blog on the new site with the slug /blog and then set that as the static posts page in the reading settings. Now that there are no files in the /blog subdirectory (just the wp-content folder) this should not cause a clash anymore I think?

          So this way all my old posts still work correctly and also still takes people to the list of blog posts.

          I reapply appreciate your thoughts Angela, you are awesome!!

          • I am glad you were able preserve your current directory structure and NOT have to go through these steps! That is awesome that you were able to keep the site in the “blog” subdirectory and simply including blog in your custom URL structure and create a page called blog and assign that as the default posts page in the Reading Settings. That is the best of all worlds in your case!!! Yay!

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

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

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

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

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

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

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

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


  12. 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 :)

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

  30. 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).

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

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

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

  34. Hi Angela,

    I just wanted to leave a note thanking you for all the information you provide! It helped me resolve my “WP-move-gone-bad-day”.

    I could finally leave my website in the subdirectory without it showing. Thanks !!

  35. Hi Angela. I think I stuffed up my brand new WP install because things went wrong when I modified the WP and site directory entries in Settings. Now I can’t log into my wp-admin any more (I get the login page ok, albeit the theme i messed up), but clicking on LOGON button results in error ‘/wp-login.php not found’. How do I reset the wp and site URLs? Are they in an ini file somewhere, or do I go to the db? I’m very new to WP. Any help greatly appreciated :)

    • Hi all. Found out how. I went to my CPanel. Launched phpMyAdmin. Selected my database. Listed all records in wp_options. Edited the 1st record (field=siteurl). Saved the record. WP works as before now. So all good. Cheers, Mark.

      • It’s so nice to know how to login to phpMyAdmin because you can fix things quickly there if anything gets messed up. Good job!

  36. Hello Angela,

    I am trying to do this very thing and I am having problems. It appears the urls I am using for either the index.php or the wp-config.php are off-my guess anyway. I am trying to make:

    Show up at:

    When I follow the instructions to a T-I get these errors:

    Warning: require(./bbh/wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in E:\HostingSpaces\bbhadmin\\wwwroot\index.php on line 17

    Warning: require(./bbh/wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in E:\HostingSpaces\bbhadmin\\wwwroot\index.php on line 17

    Fatal error: require() [function.require]: Failed opening required ‘./bbh/wp-blog-header.php’ (include_path=’.;c:\php\includes;C:PHP5\PEAR\Config.php’) in E:\HostingSpaces\bbhadmin\\wwwroot\index.php on line 17

    Any ideas?

    Thank you!


  37. Many thanks for this post, really useful!

    I’ve only had one hitch and it’s probably something simple, the home page in my nav is still referring to the /wp/ directory and showing a blank page.

    Any solutions greatly appreciated!

    Thanks again


  38. Angela:

    Though I am not new at Website admin and design, I am brand new to WordPress. I cannot tell you how EASY you made making my site live (I had installed wp in a /wp directory – old habits die hard).

    Your simple, straightforward directions allowed me to have my site live in less than 10 minutes.

    Fortunately I had moved to a Web Hosting provider and they are very WP friendly. I also had no previous website junk left in the root directory to deal with.

    Thanks again and keep on writing tips.

    bro jeff

  39. Hi Angela, It really worked for my website (Under Construction, just started to build Actually, I owe 3 linkedin groups which are considered most active and have reach strength of membership)…..I just followed your first 5 steps. Thank you so much. I really like the idea of keep sub-folder as it is.

    Rajeev Jain

  40. OK. As far as I can tell I followed the instructions exactly as above but unfortunately there is some issue that has messed up my website. I have installed the wordpress site on a subfolder called wpssf. I changed the line in the index.php file, and updated the wordpress URL.
    The old site is still up there (the original reason for doing this is to migrate from a static html site to the wordpres one), but all I am getting when I try to access the new one is

    I’m guessing it may be some redirect problem? Can anyone help please? This is something I have spent a lot of time on and aproject I really care about!

    • Hi Eric,

      This can happen from a bad theme or plugin. Try logging in via FTP and rename the plugins folder to plugins-old, and delete all but the TwentyTwelve theme and see if you can get the site to come up. If so, then the problem is with the theme or one of your plugins. Try activating them one at a time to find the culprit.

  41. Hi Angela,

    Thanks for the great tutorial, and I’m almost there, but I put my test site in a sub-domain and not a sub-directory e.g. and not

    I’ve tried all sorts of variables for the new wp-blog-header.php location in the index.php file, but nothing is working (I keep getting the ‘Warning: require(./wp-blog-header.php) [function.require]: failed to open stream:’ error message.

    I’m guessing this is due to it being in a sub-domain and not a sub-directory. Any help gratefully received.


    Pete :)

  42. Hi Angela,
    This page is bookmarked, have used your method on several sites and works great!

    I encountered a problem today though…
    I am using a site with multiple users, and after using your method/move, when a User logs out, it redirects them back to the subdirectory ie (where the front-end site used to reside and where the wordpress is still currently) and it comes up as 404 missing page?

    I copied index.php as opposed to moving it to root directory, so there is still an index.php in the subdirectory and I thought this should then still work but guess not.

    I have tried adding Redirects from to but these are not working.

    Have you encountered anything like this before? Possible solution?


    • Definitely NEVER use redirects to fix this. That will cause more problems. After following these directions, the URLs will display for the root of the site, as will the home page. The login page will still be under the /wp directory as

      However, on logging out, the loggedout page will still be wp/wp-admin since WordPress is still in the subdirectory. The only thing my instructions do is allow you to VIEW the URLs for pages and posts from the root. You have not actually moved the WP installation. I have never seen a redirect from the logout to some static page, so I don’t know what would be causing that unless there was a typo when you followed the instructions in this post.

  43. Wow, I am sooooo pleased with this method! I had no trouble at all getting this to work and I was expecting the worse to happen (I did multiple backups b/c I was scared of losing all my many hours of work) but your instructions were a total breeze compared to other methods I have researched.

    I have one question though… I have the Google XML Sitemaps plugin installed and now that I have followed your instructions I noticed there are now two sitemap.xml files residing in the files. One is in the root directory, and the other is in the original subdirectory I initially built the site on.

    Should I remove one of those? Does this cause any issues with Google indexing my site or thinking there is duplicate content?

    Thanks again for these instructions, you saved me tons of time and I will be doing all my new sites like this from now on!

    • Hi Jen,

      Delete the XML sitemap in the subdirectory and then use the plugin to regenerate the one in the root, so the pages have the correct URLs.

      If you had the site up for awhile previously with Google, you might want to sign up for a Google Webmaster Tools account.

      Also, install the Redirection plugin and do manual redirects on any of the old URLs that might have been index by Google. Google will eventually recrawl and reindex the site, so those old URLs with the subdirectory in them won’t be an issue over time.


      • Thanks Angela-
        I already had this site initially set up in my Google Webmasters account, but it had not been verified yet. Just followed your instructions with removing the sitemap file in the subdirectory and then regenerated the one in the root (although I think it had already done so on its own after me making more changes to the site today).

        On a side note… do you enter both the www and non-www versions of your sites in G. Webmasters? I had read that we should have both of them, then verify both sites, then set the preferred domain to one or the other.

        Is that the way you do it? I’ve always been kind of confused by the www vs. non-www versions. I’m hoping I have my settings correct so it doesn’t look to Google like two sites with duplicate content.

        Thanks for your help, you have been wonderful!

  44. Hi Angela,

    Just did this properly on a new site with a subFOLDER! BRILLIANT!!!! You are a miracle worker – thanks so much – from now on I’ll be using this on every WP site I build.


  45. Awesome Information on this page. I tried a number of combinations to try to get this to work properly. I have done this before in wordpress and it was a piece of cake, but it must have been the hosting company I was using (HostGator). Today my client is using Godaddy as the host.

    I followed all of these steps to a T, but was unable to get it to work. What I ended up having to do is copy .htaccess and index.php file from the subdirectory to the root. I deleted the original .htaccess and followed your steps on having WP create a new file. When I tried without the subdirectory, I was getting “Warning: require(./wordpress/wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/content/31/8187731/html/wp/index.php on line 17″

    This told me something was up with how this file was being referenced. So I changed the code in the root level index.php file

    I also had to make some changes to the .htaccess file.

    The home page loaded fine but none of the other blog pages would load. I then went into the /Wordpress/index.php file and removed the step were I added and replaced it with the original code.

    I have spent way to much time to try to figure out if there is a better way of doing this. Your feedback would be great Angela and I wish I found this article last night. Thanks again for this post.

      • The point that I am trying to make is that


        Does NOT work.



        The issue here I think is the relative URI . I did not try to this but I would bet /Wordpress/wp-blog-header.php.

  46. Hi Angela, Thank you so much for this post!! I have bookmarked this page and others, because they have been so helpful. When my site is up, I will definitely provide you with some link juice. :) Just one question, but will the steps above work if I am using a Genesis and StudioPress theme? I have just completed a WordPress sub-directory install (for all the reasons mentioned above) only to be told it might not be possible to copy or move my website over to the root? Would you be able to shed any light on this? or Should I just start fresh and do a root directory install.

    • The reason perhaps they told you it would not be possible to copy or move the website to the root is because it is cumbersome to actually “move” the installation to the root and will break a lot of stuff — like all your image links. This is why the process outlined in this post is awesome, because you don’t “move” WordPress — you just tell WordPress what URL you want to display the permlinks from and what URL the WordPress application is actually installed under. Simple. Clean. Easy.

  47. Hello Angela,

    Since a while I redirected all the ancient static pages on my painter’s website to my WordPress installation which I formerly used as a blog. And now I wish to cancel the /blog/ from my Url to keep only the root ( But I could never achieve (hopefully I’ve been able to switch back to the previous state and my site works again). So I’d like to precise a couple of things with you if you are ok.

    1/ In the WP codex I found this sentence: “The “Home” setting is the address you want people to type in their browser to reach your WordPress blog”. But in another page of the WP codex (Using a pre-existing subdirectory install) : “In the box for Site address (URL): change the address to the root directory’s URL”.
    So it looks like I did it wrong when changing the first field (Home) to the root directory. I should have change the second one named Site Url. Do you confirm?

    2/ After I did it, I could not login anymore, my site turned upside down, and the WP Settings page changed into a warning page wherein it was written:

    Warning: is_writable() []: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/XXX:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp) in /home/XXX/public_html/blog/wp-admin/includes/misc.php on line 133

    Warning: Cannot modify header information – headers already sent by (output started at /home/XXX/public_html/blog/wp-admin/includes/misc.php:133) in /home/XXX/public_html/blog/wp-includes/pluggable.php on line 876

    The first warning mentions php4 but when I checked my htaccess I could never find something like the sentence “AddHandler application/x-httpd-php5s .php” (found in your other post) even though my web hosting runs with php5.

    3/ And finally, in case I can fix it and change my Url to the root, I’m not really sure of how to set the plugin “Redirection” in order to redirect all my actual /blog/ Urls all at once (and same for my old static pages which have all been redirected one after the other with the redirection tool of the cPanel).

    Hope my questions are not too confuse.. Hope my english is Ok too!

    Thanks in advance.
    From France, kind regards.


    • Hi Hazio,

      1 – The process I describe in my post are instructions for successfully keeping the WordPress installation in the subdirectory while display all post and page URLs from the root.

      2 – It’s important to not have any typos or forward slashes in the URLs. Not sure if your problem is related to that or the .htaccess file. You can contact your web host to ask them how they are handling the PHP 5 selection. Some do it via .htaccess, others do not. If you did not edit the index.php file and move it to the root, then there can be problems with WordPress finding the installation. Or, your theme could be poorly coded and not finding things correctly. If something was not set correctly, you can login to your web hosting control panel and access the WordPress database via phpMyAdmin and reset the settings. Please see this post on how to do that:

      3 – It’s hard to do bulk redirection simply because ALL of the image URLs, uploaded files, and WordPress application itself will still be located in the subdirectory. In this case, it might be better to actually physically MOVE the WordPress installation and then you can use an .htaccess redirect to do a bulk redirect to the root, but you’d also need to run the Search and Replace plugin on the content of the site to replace any image urls, uploaded file urls, and internal links to the new url without the blog in the url.

      For the old site HTML files, the bulk .htaccess redirect (see below) will simply redirect the exact same name URLs not the old htmls, so you will need to re-enter the new location for those in the Redirection plugin (though since those redirects are already in place, the .htaccess file may take care of the redirecting them yet again).

      Here’s the .htaccess bulk URL redirect command:

      RewriteEngine On
      RewriteBase /
      RewriteCond %{HTTP_HOST} ^$ [OR]
      RewriteCond %{HTTP_HOST} ^$
      RewriteRule ^(.*)$$1 [R=301]

      Again, this ONLY works IF WordPress is MOVED to the main directory and is NOT in the subdirectory. But, first, take care of what was messed up on the current site, so you know everything works before you attempt to move anything in the FTP folders. Let me know if you need some help.

      • Thanks a lot Angela for taking time to answer to the questions of a “rookie”. I’ll check the php situation with my web host.
        Concerning the htaccess, I thought I could maybe first replace the main directory current one (which I saved) with the one of the wordpress subdirectory and then copy inside it the current redirections (old static files).
        And of course I’ll try to use your bulk url redirect command for the current /blog/ Urls.
        Does this make sense for you?
        It seems to me easier than to physically move the WP installation because I’m a bit scared with the searchandreplace scripts or plugins (I’m not that aware of how to set them good and they can easily break all).
        Thanks again for your patience!

        • Everything is fine now after I carefully followed your instructions.
          Concerning my ancient static files,I finally found a way to redirect all the folder to the actual site, with the following code in the main htaccess (excluding some pages that I prefered to redirect to a specific url) :

          RedirectMatch permanent ^/AncientFolder/(?!SpecificPage.html)(.*)$

          So Google should be happy!

          Thanks again Angela for your helpful reply, for the posts here, and for the time you spend for the others.
          All the Best!

  48. Hi

    I am just about to start implementing the switch over and have just one question. My current site which is in the root directory has an index.html file and then numerous html files for the various pages.

    I am wanting to do 301 redirects for all html pages to my new wp pages to keep my link juice.If I have to remove the index.html from the root then won’t the 301 for this page be useless?

    Any help would be great and I really appreciate your excellent advice.



    • Hi Robert,

      When you are ready to make the switch, copy all of your old HTML files into a folder, so they are no longer in the root. Later, you can download these as an archive and then delete them on the server. The reason I say to put them in a folder is just in case you need them immediately, but you definitely want to not have any of them in the root, particularly the index.html file.

      You do NOT need any of these pages existing to do the 301 redirects, and it’s better if they are deleted ultimately.

      After yo do the process outlined in this post to move your WordPress index.php to the root and make the other changes per the steps in this post, then you can install the Redirection plugin and do 301 redirects on all those old HTML pages to your new WordPress pages. Again, those old html pages can be deleted and do not need to exist in order to redirect their URLs to the new URLs. However, you will want to make note of all those old URLs in order to do the redirects correctly.

      Good luck! Let me know how it goes.


  49. Just thought I’d toss in something that was helpful for me. While following these directions worked for my homepage, all subpages would return a HTTP Error 500 (Internal Server Error). No matter how much futzing with the .htaccess file and/or the index.php file I did, nothing seemed to work. On a whim, I deactivated *all* plugins and: voila! All subpages began working. I then turned each plugin back on, and all of them seem to work fine now. The one problem I’m still having is that I can no longer seem to preview changes to pages, instead it returns, “You do not have permission to preview drafts.” This is a bummer, but at least everything else is up and running.

    • Hi Travis,

      Thanks for writing. Yes, that is very puzzling. Sounds like a badly coded plugin. I have never had an issue with plugins with this process. However, one thing you can do is DELETE your cookies in your browser and delete your browser cache. That should solve your preview issues. It could be the authentication for your user session vis a vis the browser cookie got confused.

      Let me know!


  50. Hi Everybody,

    I have successfully migrated from to It is actually stored under but I have made this “transparent”,

    All works fine till now… crossing fingers ;-))

    My only concern are google webmaster tools… only available for root domains. So I cannot transfer my links to

    Anyone has got the same problem and has managed to fix it?

    Thank you in advance for your help!

    • If you are changing domain names, there are two things you can do:

      1 – Add both the old and new domains to Google Webmaster Tools. You will have to download and FTP the unique html verification file to both the accounts. Then, you can indicate in the Webmaster Tools for the old account that you have changed the address. This is just a nice informational thing to do for Google.

      2 – If you had a lot of traffic on the old domain, then you can install an .htaccess file on the old domain with this code to do a wild-card redirect to the new domain. It will automatically redirect all all the old URLs to the new URLs:

      RewriteEngine On
      RewriteBase /
      RewriteCond %{HTTP_HOST} ^$ [OR]
      RewriteCond %{HTTP_HOST} ^$
      RewriteRule ^(.*)$ http:/$1 [R=301]

      Do not use this rewrite to redirect to as that will mess up your access to the WP admin directory if you still have WP installed in the subdirectory.

      If you did have a site at which had a lot of traffic for which you just decided to display at, then you can use the Redirection plugin to redirect the old URLs to the new ones that do not contain the /wordpress.

  51. Hi Angela hoping you can help me. I have a site set up for my son who is in the NICU to keep my family up to date with his progress. I changed the WP URL which caused the site to break. I fixed it eventually by editing the config file but my theme looks like it’s not working anymore. The theme is showing installed still but the HTML/CSS is gone from the site. I am wondering if I need to edit another file to fix this…. can you assist? It is the contango theme and all the theme files are showing in my hosting folder including the css…. I saw something out there about editing the style.php to fix but cannot find that file…. Thanks for your help!

  52. I’m doing just this for a client and am overjoyed that someone was great enough to break it down. I’ve not done this yet and this looks like it will make the job a whole lot easier. Thanks so much, Angela!

  53. Thank you so much for these clear and concise instructions. I read the ones on the official WordPress site first, but found them a bit confusing as they seem to implicate a 14 step process may (or may not–HAH!) be necessary. Yours are much better and took literally 60 seconds to implement! They also saved me tons of time, as I was considering trying to migrate my site from an old Drupal install to a new WP one–eeeek. Knowing I could develop the new site fresh in a WP subdirectory and “move” it instantly to root made my life 10,000 times easier, since doing anything remotely complicated with Drupal is a triple nightmare.

    A note: I’m on Hostgator and didn’t need to copy/move .htaccess. I deleted the old .htaccess file in root that contained the Drupal settings, and it spontaneously regenerated.

    Thanks again!

  54. Interestingly, I was in a panic and didn’t have time to call the service provider and have them start changing the staging site’s DNS – so I took a crazy chance and just re-uploaded the entire staging site (wordpress installation and all) to the root directory (there was nothing there previously). Then I logged into the Dashboard and changed both addresses to the root level and it worked! Some of the images are still pointing to the old staging area uploads but that’s OK. This service provider doesn’t locate the database where the domain is so it still was able to connect to it without changing the config.php file. Just an FYI for anyone else who runs into this brick wall at 7pm when the site has to be live ASAP!!

    On to a new installation this time I’m going for a subFOLDER and I will be trying this method out. It’s a lifesaver! I wish I had seen your article in 2011. I searched the web for this topic a few years ago but couldn’t find a good solution – only some scary looking plugins that “might work”.

    Thanks for figuring this out and for your speedy response!


    • Yes, the config file should not have to change if you stay on the same host. If people decide to actually physically move the WP installation to the root, instead of following the method outlined in this post, they would want to first change the General Settings to remove the / and the subdirectory name (important that site does not end with trailing /), then move all the files to the root (aka public_html folder), then use the Search and Replace plugin to rewrite the URLs to the images and hyperlinks (important to ONLY do Search and Replace on CONTENT area, otherwise, there can be unexpected consequences doing a full search and replace in the database — such as republishing of all your posts to the RSS feed).

      For “moving” WordPress or doing other types of migrations from one site to another, particularly if the site URL changes (from a dev server to a live server), I usually use the BackupBuddy plugin, because it automatically handles all the URL rewrites correctly, with the exception of some plugins I’ve used for sliders that might have the image URL stored in a way that BackupBuddy does not typically access.

      Anyway, glad this whole process worked out for you.

  55. Hi

    I was VERY excited to find this post and followed your instructions to the letter but can’t get the menu items working. The site redirects properly but when I remove the “staging” part of the URL from the menu items the menu goes to the root directory – where there is nothing there. You mention a possible fix in the header.php file but you don’t say what that is. Is it in here?


    • Hmmm… the wp_get_nav_menu should just get the URLs for the pages, which, if you followed the instructions, should now use the root URL not the subdirectory. Have you created a custom menu under Appearance > Menus or are you using the default menu of pages?

      Can you visit a page okay without the subdirectory in the URL (not using the navigation)?

      You can contact me via my contact form with your URL if you want me to take a peak.

      • Thanks for your SPEEDY reply Angela, this is awesome! I need to make this live ASAP! Yes, I’ve used Appearance > Menus – 2 of them are custom and the others are just a Page but I could make them custom. I can’t remember if I removed the index.php file from staging when I tried this earlier today though. I don’t mind giving you access, but how do I do it without posting login info here?


      • Hmm what seems odd is the permalink thing – you have your path blacked out so it’s difficult to tell how it works – but the original permalink where my wp is installed was:

        - now if I make your change for example “contact” would look for this -

        which isn’t correct so I can see why it comes up blank – even if I use dot…

        it’s in the wrong order.

  56. Hi Angela,
    Thanks for your instructions. I have followed them, as well as the official codex instructions, and keep ending up with a blank root homepage. Any ideas?

    • Ah! I wonder what might be happening. Can you contact me via my contact form with the URL to your site? It does sound like perhaps a little mistake.

      • Hi Angela,
        I wanted to follow up on the record and say that migrating my site from a Windows account to a Unix account resolved all the of issues I had been experiencing. Your instructions took me all of 90 seconds just now to get a working site. Thanks for pointing me in the right direction!

  57. This was a GREAT help — however, I have one big problem that could be entirely my own doing.

    I’ve changed everything as suggested, and my blog that was previously under is now appearing pristine on — great!

    However, I have a completely unrelated subdirectory under my root called ‘slide’, and while the index page of will display fine, anything UNDER the slide directory (like WordPress interprets as some complicated page name and tries to display using WordPress–which of course isn’t going to work!

    If I change the permalink structure to the default (ugly /?page_id=##), the problem is solved, but then I’m left with ugly permalinks and faulty links all over the place since I’ve been using structure using the post/page title everywhere up til now.

    Any suggestions at all? I’m desperate!

    • Hi Courtney,

      I have had other HTML files in subdirectories and have never had this problem except when there is a similarly named page in the WordPress installation causing WordPress to try to interpret that URL as a post or page. WordPress will try to parse any URL that it sees to see if it is a WordPress page or post or category or archive, etc. I think it’s important that your naming conventions are strictly followed or WP will choke. For example, if you use capital letters in your directory names on the server, then the browser may not interpret the URL correct and WP will try to find the page and not be able to find it. If you want, you can email me via my contact form, and I’d be happy to poke around your FTP structure to see if there is something obvious that could cause the URL to not be read. It’s often something simple.

      • It turned out the htaccess file in the subdirectory itself required a bit more finessing (ultimately, after a harrowing few hours, I finally realized the one line missing and resolved the issue).

        I’m now having issues with the permalink structure mucking up my bbpress installation, which suggests that I and my good friend .htaccess will be spending a bit more time together, but at least this has been resolved.

        • Here’s what I think is happening: You have too many .htaccess files. I would personally delete ALL of them (or rename them .htaccess-bk). Then, login to WP, and go to Settings > Permalinks and click Save Changes. This will automatically generate a correct WP .htaccess file for WP which then should not mess up your subdirectory with the static HTML files. I have encountered similar issues when people have had a bunch of .htaccess files all over the place. Having just the one with the proper WP settings as auto generated with the settings page will typically take care of these problems.

          • Alas–an excellent suggestion, but ultimately a futile one. WP generated a lovely new htaccess file just fine, but bbpress remains intractable. For a plugin developed by the wordpress creators themselves, it sure does have a lot of difficulty properly integrating with wordpress :/ It appears I’m going to have to try a commercial solution, as the bbpress support forums have never been much help…

          • Some more complicated functionality might not respond well to operating in a subdirectory. I know BuddyPress has a hard time if doing this method of installing in subdirectory and running from the root. What you might want to consider doing is using a plugin like BackupBuddy to backup the entire site (db and files) and “migrate” it to the root. Using Backupbuddy will help with all the URLs that need to be rewritten in the database when “moving” WordPress without breaking anything. You can also just physically “move” WordPress to the root and change the General Settings accordingly, but then, you would have to do some SQL query to rewrite the URLs from the old to the new. There are numerous blog posts on how to do that without messing things up, but I find BackupBuddy to be the most fail safe method. It’s possible, then, that bbPress will be happier running from the root rather than redirected to the root.

            I have never run bbpress out of a subirectory situation like this. Also, be sure it’s bbpress and not the custom menu item that needs to be fixed. However, it wouldn’t surprise me if being in the subdirectory but redirected to the root for the URLs could have confused it.

          • “Also, be sure it’s bbpress and not the custom menu item that needs to be fixed.”

            I can be quite sure it’s not the menu item, as even links such as the latest post in the freshness column or links to individual replies in a topic thread itself throw the same error. It’s very much that URL itself that’s proving problematic.

            I had actually originally intended to do just that–move the wordpress installation to the root and run it from there–but after seeing how complicated it would be and all of the database adjustments I’d had to take, I was relieved to find this alternative which seemed so simple.

            Do you know of any good hand-holding tutorials for using backupbuddy off the top of your head, or shall I do some googling now? I haven’t come across that option thus far, and it seems like the path of least resistance.

  58. Angela, before I proceed with your tutorial, can I get a confirmation that this is something that will solve my situation?

    Lets say for example my site is BIKE.COM. This is the main wordpress site. Its 4 main folders: cig_bin, wp-contents, wp-admin, wp-includes are in the public_html folder.

    I created a sub-domain called This wordpress site is also in the public_html but its 4 main folders are inside a folder called SHOP. Is the SHOP folder what you call a sub-directory?

    So knowing my current set-up, should I still follow your instructions? Because I was immediately lost with step 1. LOL! It says to install wordpress, but don’t install it in the root public_html, install it in a sub-directory. Which had me confused immediately because I’m trying to move my sub-directory site into my main site, so why would I do that? I know there is probably some basic understanding that’s flying over my head right now.

  59. thank you! this is exactly what I was looking to do. One problem I am seeing, if my old site was bookmarked, and you navigate to, it shows the “This is somewhat embarrassing, isn’t it?” error message. i tried a redirect from my control panel, but that does not work either. i tried to redirect to, but it still shows the “This is somewhat embarrassing, isn’t it?” error message. any suggestions? thanks again!

    • Hi Jimmy,

      I would recommend you install the Redirection plugin and enter 301 redirects from the old pages/posts to the new URLs.


  60. Just a followup from my post last night. After some further research, it looks like I should be using Linux so I’ve changed this in GoDaddy. After the change, I’ll see if I can get everything working properly.

  61. Hi AskWPGirl, thank you so much for taking the time to write all this up so clearly for everyone. I created a wordpress site in a “wordpress” subdirectory ( and was trying to change the Home URL to the main root directory. After some trial and error, I now have the site showing up at but none of the images are showing up on any of the sub-pages. I did check the permalinks and saw that they were updated in the dashboard. Also, I have found that I cannot access the site admin dashboard unless I delete the web.config file in the root directory (I guess I do not have an htaccess file but this web.config instead??). When I do delete it, I can access the admin dashboard but the site no longer displays at all at I’m hosted on GoDaddy. You mentioned an issue with them updating once an hour. Do you think this could be the issue or is there a bigger problem? thanks, Sara

  62. Thank you for this info. I am doing a whole revamp of my website, and have more than one install of WP and some subdomains and parked domains – the main part of my site is currently HTML. I plan add a new WP install for my main part (root), and am glad to see I can run it from a subdirectory while still appearing as root (while also running other installs of WP on the site.)

    Can I have no other pages in the root that can be accessed once I virtually “move” the WP into root – or does every file need to be switched to a WP post/page? Does *everything* need to be in a subdirectory – or just pages and images? (There are other files in there, such as php redirects.) I have a contact POST form – can that be put into a WP post? Do these need to be put in a subdirectory?) I was planning to use redirect code on the old HTML pages to go to their new WP pages? Is that what the Redirection plug in is for? With Redirection do I need to enter the old page URL and the new post URL for every page that I switched from HTML page to WP post – doing essentially the thing I thought I was going to do – only through a plugin? Also it says Redirection hasn’t been updated in a while and isn’t confirmed to work with latest WP, does it?

    Further on Redirection, on a current WP install. I want to change the permalinks (to take out date and just use post name.) I tried and WP did not redirect the posts. With Redirection, if I activate it before I change the permalink structure, will it automatically redirect them? Also I plan to change the subdirectory name that the WP install is in. I used Velvet Blues to update links for another WP install that I changed the name of, but it was much smaller and I wasn’t worried about redirects so much since navigation is much clearer. Do I need to use Redirection instead for this too, or will Velvet Blues work?

    Thank you for all your info and help!

    • You can have other WP installs in subdirectories as well as subdomains. I have that on my site. For example, is in a subdirectory with the index.php file for it in the root, then I have a site installed in another subdirectory, which I access via that subdirectory and another subdomain in the a folder in the root directory. It all works fine. The only issue you could run into is if the subdirectory name matched the slug name (page or post or category url) of the main site.

      You should delete the old HTML files and use the Redirection plugin to redirect to the new URLs. Also, install the XML Sitemap plugin, so that will give the Google Bots a new sitemap to crawl. You definitely want to use the Redirection plugin.

      For the contact POST form, don’t use that! It’s a pain in the ass, and the Visual Editor in WP will kill the code. Instead, use a good form plugin to create a new form using WordPress, such as Contact Form 7, Gravity Forms (, or Fast Secure Contact Form. All except Gravity Forms which is a premium plugin are available from and can be installed via the plugins interface in the WP dashboard.

      If you had previously used the date and then change to the Post Name format for the permalinks, you will need to use the Redirection plugin to make that happen. I’m not sure it will automatically pick up on that change, though.

      If you change the subdirectory name, you are in a world of hurt. Everything will break or can break. You can do it, but you’ll need to use the Search and Replace plugin to do a global search and replace, but ONLY on the content. Some other plugin things might get screwed up to. In that case, I usually use BackupBuddy plugin ( which you can do a “migration” to the new subdirectory and it will automatically rewrite all the URLs for you. No, do NOT use Velvet blues or Redirection plugin for this. That will result in weird, unnecessary redirection loops.

      Sorry it took so long to respond. I was on vacation when you wrote. Feel free to email me if you have any more questions.


  63. Thanks for the article. I have an issue with a site that has existed for a number of weeks. I have completed the instructions and all works fine the site when you navigate it is no longer showing the subdirectory.

    However there are probably quite a lot of links from other sites which include the subdirectory in the URLs. I’ve noticed that on any parent level pages if you include the subdirectory in the URL it successfully redirects to the URL without the subdirectory, but any child menu pages with which you use the old site directory (i.e ‘’) do not get redirected to ‘’.

    So the first question, is there something I have done wrong or is this normal?

    I’ve tried a RedirectMatch 301 but the redirect does not seem to be working, when I manually input a URL with the old Subdirectory it does not redirect to a version without it. Is my htaccess file correct (see below).

    And surely if I use a redirect match like that it would it close access to the admin pages/login?

    My htaccess file looks like the below at the moment (my wordpress install is in ‘subdirectory’) and I can successfully bring up the site and navigate pages without any problems at the root url:

    # BEGIN WordPress

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

    RedirectMatch 301 ^/subdirectory/$

    # END WordPress

    Any help would be greatly appreciated.

    • I think I may have answered my problem here with a bit of experimentation.

      I had permalinks set to ‘post name’ when I was getting this issue. However I couldn’t understand why I was having the same issue on another site I administer.

      Comparing all the settings I realised I had permalinks set to Day & Name for this other site.

      I adjusted the permalinks to match on the site I was having problems with, and any external links to a page on the site with a URL incl;uding the old subdirectory will automatically be redirected to the correct permalink page/post URL without the subdirectory.

      So far everything seems to work as expected.

    • You have to be careful with wild card redirects like this because your wp-admin and the wp-content folder are still located in the subdirectory, so I wouldn’t use that type of redirect. Instead, you can install the Redirection plugin and manually enter redirects for the old page URLs to the new page URLs. My instructions work very well for development sites. It’s a bit trickier to do this process for older sites because of potential external links.

      The reasons the posts redirect fine is because WP can generally parse that URL and figure out how to match the post title in the new location. Pages don’t work like that because of the page hierarchy — child pages. Changing a parent page URL will always result in broken links. Therefore, using the Redirection plugin for these specific pages is best.

      • Hi Angela,

        Thanks for the article for moving the WP site to root.

        I’ve used it alot and like Jaime, i realised that it seems to work only on the root level and the rest of pages/posts are still pointing to the development folder.

        Is using the Redirection plugin the best way to “tidy up” the urls to point to the root level?


        • When using this method, ALL of the posts and pages will display from the root URL. The only things that continue to “point” to the subdirectory are the WordPress dashboard (because the files for the dashboard are in the subdirectory, of course, sense we didn’t move WP) and the uploaded files (images and PDFs).

  64. Thank you *so* much for these clear instructions. I followed them, and they seem to be working. Moved my site and all is well so far!

  65. Worked great for me — thanks! I did have to go through the extra steps, including editing the .htaccess file, and I needed to upload that to the root directory as well.

  66. You have no idea how much time this saved me. Thank you for backstopping those Codex guys — I knew there had to be an easier way! Do you have a similar article for how to move (easily) from MAMP to a live host? That’s always a killer for me, and I know it forces a lot of people to develop ‘commando’ rather than deal with it.

    One thing I didnt see mentioned in the thread was to double-check plug-ins that use internal absolute links, in my case, there’s a social media plug-in that hard links to the blog within the same subdirectory. Easy enough to fix.

    • Thanks for the feedback, Aaron. I really hate plugins and themes that don’t use the correct relative links. That’s just a sign of poor development.

  67. Thank you very much! It worked!! I’m having a problem now… I have another installation of WP in another directory and I cannot access the admin page. Any clue why could be that?

  68. Hi Angela,
    I have a new version of wordpress. Can you tell me how you replace this to make it works?
    * Loads the WordPress environment and template.
    * @package WordPress

    if ( !isset($wp_did_header) ) {

    $wp_did_header = true;

    require_once( dirname(__FILE__) . '/wp-load.php' );


    require_once( ABSPATH . WPINC . '/template-loader.php' );


  69. I just read over this and still debating whether I can tackle it. I need to update my site completely and the new one is done, I just worry about re-directs from Google. What will happen when someone stumbles onto an old page and it’s not there?

  70. Hope you can help Angela. I did as instructed, and everything is working and displaying right, EXCEPT when the contact form is submitted, the Thank You message is being displayed on a blank page (instead of in a dialog box on the site). The form contents are being sent and received properly. Here is the web address of the page containing the Thank You message:

    The site is using the Blocked theme, which is no longer supported by the developer. It doesn’t have any form plugins installed, so not sure what to do next. Thanks!

  71. Thank you for the great article… I’ve encountered a 50/50 success result of your steps and hoping you can help lead me in the right direction…. After following your steps, all the urls/links for any subpage of my site work perfectly. However, the homepage still tries to point to the subdirectory, and I get a page not found error – just this one page.

    any thoughts?

    Thanks in advance.

    • Hi, I think the problem may be that your menu item under Appearance > Menus for the Home page is still the old URL with the subdirectory in it. Check that. If you just go to your site – the main URL – does the home page show okay?

      • If I go to the base domain, it automatically appends the sub directory path to the url, and displays a PNF. I don’t see anything in the menu section that specifies an old path.

        Thanks for your feedback :)

  72. Hi AskWpGirl!

    I have a tricky question. I followed your nice instructions and wordpress is now in a subfolder and .htaccess and index.php in root. Everything worked fine for a year. Then I wanted to use a plugin called Boxer Pro. Boxer pro generates a short code that will show the content of several nice boxes on a page. The problem is that the code is only working if I type the whole address to the subfolder. Asked the company that delivered the plugin and they asked me why a used a subfolder… Do you know any way of solving this problem? Should i change my .htaccess?

    • Don’t change your .htaccess! That is not the problem. I don’t know how Boxer Pro works, but essentially, WordPress is installed in the subdirectory as are all your uploaded files, including images. So, in some cases, as with linked uploads, the URL with the subdirectory is needed. What we’ve done in my post is had all the page, category, and post URLs for the site (the site’s permalinks) use the root directory, but we did not move the WordPress application nor move the wp-content folder.

      I don’t know what you are trying to do specifically with Boxer Pro for which you are referencing the subdirectory, so it’s hard for me to tell if this is a “problem” or just the way it should work given the location of the wp-content folder inside the subdirectory.

      • Hi Angela!

        Many thanks for your reply:) I think I’m loosing my hair on this one;)
        I forgot to mention you that since I moved the htacess and index.php files to the
        root I can’t preview my pages correctly. I have to put in the subfolder name to preview
        the page. Update page works fine though..

    • If you had the privacy settings turned off (ie allowed Google to search the site in the subdirectory), then there will be old URLs cached by Google. This will resolve itself in a few weeks, but here are some things you can do:

      1 – Install the Redirection plugin and set up redirects on those pages to the new pages

      2 – Install the Google XML Sitemaps plugin which will submit your sitemap to Google and help Google crawl your site easier.

  73. Thank you very much. I know, I’m the 371st person to say thanks, but one can never have too much praise right? I do have one question. Someone at my web hosting company said she has seen things go wrong with this redirect process when people customize their sites. Since so many people do this, I’m guessing she was incorrect. Anyone know if her statement is true? I’m planning on creating a child theme and I surely don’t want any problems.

    • I do this a lot with sites. It’s just a nice practice to keep the directory structure clean. I haven’t seen any problems, except if I had internal hyperlinks to the subdirectory that need to now not include the subdirectory. Otherwise, all the images and other uploaded files will not change, because they still exist in the subdirectory.

  74. Amazingly helpful- comprehensive and well-explained. Definitely going in my archive of important info to be used again…

  75. I was wondering if you could help me. I have uploaded my wordpress page to my server but all the content in my site are gone. I have some of the links on my screen but they stand in the left side on the screen on top of each other and they are not supposed to do that and i’m missing my background and all of my pictures and the rest of my links can somebody please help me

  76. Pingback: enlaces utiles «

  77. Hi! You have NO idea how useful your post was to me!
    When I saw WordPress’s own description, I was ready to give up trying to make the /wp disappear! O_O It is THAT bad.
    However, I followed your pointers, and as a so far ~5 hour long user of WordPress or any sort of website creating anything, it was easy to follow and figure out!
    Unfortunately my site was the kind that needed to move the .htaccess file as well, and it took me a while to figure out why I wasn’t seeing it anywhere: it’s a hidden file! Have to make it visible first *lol*
    So anyways, thanks for the awesome description!

  78. Hi, wonder if you are able to help. I wish I had stumbled on your post before starting. I have my wordpress running on my public_html. Is there any way of moving them to a subdirectory now? Reason is i am running my website on wordpress and now want to add a blog page. But I’m not having any success. I have a blog post and have edited the static pages in my options setting to the blog page. Now when i go to i can see the page with all the css etc and menu but no posts? Any help much appreciated. Thank you. Naz

    • Hi Naz, It’s hard to determine what might be the problem here. When you have a HTML files in the same directory as WordPress, you have to be careful to not have the HTML files be the same name as any WordPress pages, posts or categories, because that can confuse the server as to which content to display. However, if you don’t have static HTML pages in your public_html folder, then there is no reason why you can have a “blog” page on your site and set your Reading Settings to use that page as your posts page. If this is not working for you, then there may be an issue with your Theme. To test this, try to enable the default TwentyEleven theme and see if it works with that.

  79. YOU JUST SAVED MY LIFE– Was about to follow some crazy manual procedure offered in another forum…. This was smooth & easy! Thank you so very much for the excellent tutorial!

  80. Hello,

    I am about to move my wordpress to the root directory, then I read your explanation and the comments below and found that is easier than process.
    Before doing this, I have one question. I have some .HTML web pages that has the same design as my wordpress theme. This is why these pages contain links to posts in wordpress (http://www… Should these links stay the same in those .HTML pages after moving wordpress? Or should I change them to http://www….com/example-of-post/.
    Thanks a lot for your help!

    • Make sure none of your HTML pages in the root have the same name/url as any WP pages. Then, yes, on those static HTML pages, you’ll want to edit the URLs to your WP pages to NOT include the subdirectory in the URL.

  81. You’re a genius WPGirl! I was dubious about building in a subdirectory then changing to root when it was all done after reading the ‘official’ version of how to do this. Then I found your simple instructions, which gave me confidence as a WP newbie, to go ahead – and it worked a treat. Thank you so much.

  82.  This seems to be exactly what I was looking for, I just want to make sure that all pages will move too, like will move to

    I’m sure this is a rookie question, but what the heck.

    Thanks alot for the great info!

    • Yes, the page URLs will no longer have the wpinstall in the URL and will display the same way as if you had installed WP in the root to begin with. Good luck! Read the FAQ if you get stuck or contact me.

      •  Wow, after worrying about doing this for weeks, it was almost anti climatic it went so well.   You rock!

        Thanks again,

  83. Okay – I tried this.  I edited the index.php, change the settings in the WP control panel, but got an error.  I did not move the .htaccess file to the root.  Could this be the problem?

    The site is currently at

    Thanks for any and all help!

  84. Thank you a lot! Very helpful. Far better than org procedure! I messed up my site with explanation. But with this, I manage to do it very easily and neatly and successfully! Cheers!

  85. WP Girl.  (Reminds me of Word Girl on PBS my dauthter’s heroine) 

    I’m not sure if you missed my question above.

    • Hi Carlos, Your comment last month never appeared in my queue. Strange. I think it must have been a Disqus glitch. Anyway, per your question, Photocrati is theme, and what it sounds like is that you now want to use WordPress for your entire site rather than for just the blog. It is a bit problematic having the word “blog” be the subdirectory name, but you just have to be sure NOT to name any categories or pages “blog.” There are many ways to slice this. One is that you can install the Photocrati theme on your current blog and set up all your pages in your current WordPress installation, then follow my instructions to have these show from the root. However, all of the URLs for your blog posts will be changed. The URLs will no longer contain “blog” in the URL. So depending on how many inbound links you have coming to your site vis a vis those URLs, you may not care about that. The other option would be to install a new installation of WordPress at the root and then use the Tools menu on the old site to Export the old posts and then import them into the new site in the root. Either way, the URLs will be changed, since they will show from the root and not from “blog.”

      In terms of the word “blog,” you will have a page on your site called “blog” but you’ll want to make sure the SLUG (aka permalink) is something other than “blog” – such as “photo-blog” or “my-blog.” So you will create a new page with this slug, and the page title can be Blog and the slug will be “my-blog” and you can set the Reading settings to show your latest posts on this page. Photocrati may handle things a bit differently, but typically people have a static home page with images and a separate “blog” page for the latest posts.

  86. This process has been problematic for me. I figured out that the Security Plugin I installed is the culprit. I believe that it overwrites files in an incompatible way. Anyone else have this problem, and/or have a workaround?

    • Hi Jamie, Which security plugin? I know the Silence is Golden Guard is problematic, so I won’t be recommending that any longer.

        • Silence is Golden Guard wreaks havoc with WP installs in subdirectory and totally breaks the site, so don’t use it. There are so many security plugins, that I’m not sure really help all that much. The ones I find useful:

          1 – WP Security Scanner — use once to check your file permissions then delete

          2 – Firewall 2 – run all the time

          3 – Limit Login Attempts

          • Thanks again for the recommendations. A couple of those haven’t been tested on the latest version; I’ll use what I can, but stick with known quantities.

  87. Hello WPGirl, thanks for the great info.  You make it sound so easy.  I guess everything is once you know how to do it!

    I originally created a website via a bludomain site and added my blog to it at /blog.  Now I want to switch to Photocrati which is a site plus a blog.  Of course the blog is also at /blog so how should I adjust the above directions?


  88. Hi TB,

    Sorry for the delay in response. I responded to another very similar question recently, so I thought I’d already responded. Since all the URLs display from the root and the links to all your posts and pages are root level links, I don’t see any SEO disadvantage. The only items from an SEO perspective that are linked via the subdirectory are the images and uploaded files.

    There was an interesting article on canonical URLs and a WP install in a subdirectory:

    To quote this article:

    “The reported problems seem to have been caused where the WordPress files and the public URL were in different directories.

    “In these cases the canonical URL feature in the All-in-One-SEO-Pack apparently gave priority to the URL including the sub-directory in the address – which confused the Google Bots and led to problems.”

    However, in the example I have and write instructions for, there are NEVER any URLs served up from the subdirectory, so I don’t see how the Googlebots would be confused as this person says. Also, this article is 3 years old. From my understanding, the install in the subdirectory with the URLs being served from the root following my instructions is purely for convenience, and I’ve never heard of SEO problems with it (other than the article cited above, which doesn’t make much sense to me). Many people want to keep their directory structure clean, and this achieves that.

  89. Hi, I thought I sent you a question, but perhaps it didn’t go through.  I’m about to install wordpress in a sub-directory and want to know for SEO purposes if it matters if wordpress is installed in the root or a sub-directory.  Obviously we want as best a chance to rank high in Google and will use Yoast SEO, so does the directory matter?  Thank you!

  90. Thank you WordPress Girl! Your instructions are clear, precise and accurate-
    much needed in a geeky world where the English language is not often used well.

    John Parulis

    • LOL. You can thank the great training I had at Quark as a technical writer. Though, many are too young to even know what Quark was/is. Back in the mid-90s, it was an awesome place to work, and I got lots of practice writing the post-release tech notes.

  91. Hi, just curious if the big three search engines (I.e. Google, Bing and Yahoo) have an issue with my pages remaining in a sub folder for indexing? I use Yoast SEO plug-in and find it quite handy. What do you think? Thank you.

  92. I just wanted to say THANKS for these clear, easy to understand instructions. I am no web developer, but manged to follow these instructions and get my site working in the right directory. Thanks for the help & advice!

  93. THX this worked out (and with having to do the .htaccess and permalinks). However, I have a few “private” pages so they dont show up in the main menu as parent/childs and text linked to from pages (to “read more” type of thing). Under the new naming redirect (to main root like other pages) these show up as “not found” pages, but you can see them if you manually type in the ‘old address’ with the subdirectory (i.e. vs. I appreciate your time.

  94. How can I upload a new theme to my multisite wordpress-Always come up error/css style missing. I also tried uploading to my filezilla. still doesn’t work. Please help. I really don’t know, what to do. Thank you.

    • Make sure that your actually uploaded the full theme folder rather than the zip version of the file or the full theme files rather than just the actual folder containing the theme. What theme are you trying to upload? You should see an index.php, style.css plus other files in that folder.

    • Make sure that your actually uploaded the full theme folder rather than the zip version of the file or the full theme files rather than just the actual folder containing the theme. What theme are you trying to upload? You should see an index.php, style.css plus other files in that folder.

  95. This worked for me:
    1) Using FTP, copied index.php to my computer, then copied index.php to the root directory of site – /web , in my case
    2) Under dashboard//settings/general:
     WordPress Address (URL) - left ‘as is’, pointing to /web/wordpress folder
     Site Address (URL)           - changed to site homepage (different from WP folder files)

    Had issue with site still pointing to old home page.
    3) Renamed to old-index.htm – it WORKED! 
    (index.htm is first place that code looks  to establish home page, so this MUST be renamed so index.php can be accessed first) 

    Minor wp-admin issue occurred – could not login to site, so had to add /wordpress/wp-admin to site name for site updates (wp-admin file is still under wordpress files, not root directory) Will leave this way for the time being.

    Thanks WordPress Girl – this was a big help!

    • When you login after completing my steps EXACTLY, then you will ALWAYS still login via the URL that is the sitename/subdirectoryname/wp-admin because that is where WordPress is installed. As part of this process, you do NOT MOVE WordPress, you are simply having the URLs for posts and pages display from the root instead of the subdirectory. All the images, uploaded files, themes, plugins, wp application, etc. are still in the subdirectory. Does that answer your question?

  96. AskWPGirl – you are an amazing find! Thank you so much for this easy to follow guide – you saved me hours of frustration and fright! :)
    I followed the instructions above however – I seem to be having an issue with a link.
    I did a trial run of the migration (changing from to Everything looked great, except … when i click on OPTIONS in the menu, it takes me to the correct page, however, when i try and click on any of the other menu options (BATH, KITCHEN, etc) it errors out with ’404 PAGE NOT FOUND’ i did notice for some reason it wants to reference the original link; is there a way for me to fix the link? i did update the permalinks – but this did not fix the issue.  thanks so much for your help!

    • Did you copy or move the index.php file to the root directory for the site and modify it per the instructions I sent? If you did not do that, then the URLs will not work. You have to follow all of the steps in the post. If you skip a step, then there are problems. Also, your .htaccess file may need to be moved to the root as well. On one web host I work with, the URLs give 404 Page Not Found if the .htaccess is in the subdirectory. Check the .htaccess to make sure it doesn’t contain the subdirectory in it. Also, you will need to get rid of the current pages on the site so they don’t conflict with the WP urls. You can’t have both index files in the root. So, please follow these steps, then if you want to hire me to help you, please contact me via my contact page at Good luck!

  97. Hi. I have default WP installation. With no content other than the example content. It was installed by default in /wordpress. I want to move it the root of my domain. I have the index.php file correctly changed. I have the .htaccess file with the correct information in it. Yet going to my domain site I am prompted to download a file named ~ and nothing more. Everything that I can see appears to be done correctly.

  98. Great! All fine except that the images do not show up on my pages.
    I can see the img src is set in the root directory, but the images are in wordpress directory.

    Any clues on how to fix this please?

    Thanks so much, this is exactly what I was looking for. 

    • When using my instructions, you do NOT change the img src location. The reason this process is simple, is because the image links do not break. However, if you manually changed these, then they will be broken. The images still exist in the wp-content folder that still exists in the subdirectory. So the url to the img src should include the subdirectory.

  99. Hello, thanks for your info it is very useful. Right now i am finishing my website redisgn using wp which is installed in a subdirectory (while the old non-wp site runs at root). As you mentioned, keeping the site under a subdirectory has a lot of advantages, but does it have any negative impact in SEO? Is it worth in SEO terms to move the site back to root instead of keeping it at a subdirectory? Thanks a lot and regards from Mexico!

    • Keeping the WordPress installation in the subdirectory while having all of the posts and pages displaying from the root directory does not impact SEO because the pages and post URL all display from the root. Only the WordPress application functions are in the sub-directory along with the uploaded images. After you go live with your site, install the Google XML Sitemaps plugin and the All in One SEO Pack (which should have a sitemap built into someday soon) and get those setup properly. Sign up for Google Webmaster Tools and submit your sitemap. You might want to install the Redirection plugin to redirect your old site URLs to the new site, though I recommend turning off the option in the plugin to Monitor WordPress Posts, because that inevitably causes crazy issues.

  100. Hi I had a site in a subdomain, thought or read that you should just change the site url and the wordpress url to the main domain, did this thinking I could change it back if it didnt work, now the site has many 404, and links and theme template has disappeared completely.
    Can it be rectified, or do I, or should I un-install it and do a complete rebuild. 

    Cheers TOny

    • Hi Tony,

      My instructions apply ONLY to WP sites installed a sub DIRECTORY or sub FOLDER, not a sub DOMAIN. Subdomain works differently and will not work following these instructions. To restore visibility and access to your site, you will need to login to your database with phpMyAdmin and modify the URLs for the site and the home (see the FAQ for this blog post) and change it back to your subdomain URL for both.

      To have your subdomain be your main domain, you can ask your web host to point your main domain DNS to the subdomain directory, then change your General Settings to use the main domain url in both fields and use the Search & Replace plugin to replace the old subdomain URL with the new main domain URL for all the uploaded image content and internal hyperlinks.

      • Thank you WpGirl
        I see the error of my ways ha ha, thats a big help, thanks for your advice and time, 
        will try what you suggest and see what I can find

        Cheers Tony xx

        • Hi Tony – I should definitely emphasize that at the top of the post and perhaps write another post on the subdomain transition. It’s a bit challenging, because web hosts handle subdomains differently.

  101. Thanks for the great tutorial! I was having an issue where all pages but the home page were showing up. I read through your FAQ page, and the culprit was some old index.html files alongside the index.php. I archived the .html files, and everything’s working now.

    I appreciate your great work.

  102. hello, I also have WP installed on a subdirectory ( I have created a multisite network and am trying to create a new site at I am only able to create a second site if I create another subdirectory under What am I missing? I can I create a site at the root directory when WP is installed on a subdirectory already and powers a website under the same subdirectory. I am new at this so perhaps this is bad design to begin with…Please redirect me gently :-) Thanks

    • Hi Joelle,

      It is not clear to me WHERE you have created your multisite network and what you are trying to accomplish or how you have your multisite set up. Multisite is very different from the regular WordPress and the multisite network could interfere with your installing other versions of WordPress in other locations if the URL relates to your other networked site URLs. Also, multisite will NOT work installed in a subdirectory and redirected to the root. For multisite to work properly for subdomains, it should be installed in the main URL of the site.

  103. Hey this is brilliant, however i have another question
    i have a wordpress installed in a subfolder and i have an HTML file in the root which contains flash site, i then i have a link in there which points to the wordpress site which is in the subfolder

    i want to be implement this same thing as above while maintaining the flash site in the root

    is it possible


    • Hi Antony,

      That’s a great question. So, you want to display all the WordPress URLs from the main URL but keep the Flash in the root, correct? The main issues I would see with this are:

      1 – Is the Flash file invoked via an index.html or some sort of index file that would conflict with the WordPress index file?

      2 – Is the Flash file the landing page for the domain? If it is, then having the WordPress index.php file in the same directory may conflict.

      3 – You said the Flash site points to the WordPress which is in a subfolder. If you resolved 1 & 2 above, then you would need the Flash link to point to the new URL for the WP page you are wanting it to go to after following the steps in my post.

      You could certainly backup your WP site using a plugin like BackupBuddy ( – my affiliate link) and then try the steps in my post and see if it works. Not knowing the name of your Flash file and whether that is the home page of the site is a bit tricky. However, being a resourceful person, I would follow the instructions in my post, then create a blank php page template within WordPress (eg page-flash.php) and assign this page template to a new page in WordPress called “Home” or “Splash” and choose this as the Static Home Page under Reading Settings. In the page-flash.php template, I would put the code to launch the Flash.

      If you don’t know about creating custom WordPress page templates, this might be Greek to you, but it would be one way to keep the Flash functioning and WordPress at the same time from the root, by incorporating the Flash into the WordPress install. It won’t change the look of the Flash, it will just make it behave from a URL standpoint properly by being an object on a WP page (that is — a totally blank WP page so it doesn’t disrupt the look/layout of the Flash).

      • thanks for your response

        Hey the flash file is evoked using the Default.html file, which has precedence over Index.php right ?Yes the Flash is the landing page for the Domain, the landing page has an enter here which redirects to the wordpress site, the URL for the link is given as wordpress/index.php

        so i should be able to do your procedure as long as i have the landing page as default.html and of course i have to point the enter here to /index.php right ?

        if you want to have a look at the site here it is

        • I’m not sure if the default.html will conflict with the index.php. I think it will, that’s why I would personally create a page in wordpress called “home” or “flash” and make this the default home page for WP under General settings, then create a custom page template that basically has the contents of your default.html page on it. If you want to hire me to set that up for you, I could.

          • you might be right, i default.html does conflict.
            i am going to try the custom page template, if i fail i shall get back to you.

            thanks WPSupergirl

  104. Thank you soooooo much!  I have followed your instructions and all worked well except I can’t get the home page navigation link to work.  Have installed plugin, looked over code and still can’t make it happen.  Any thoughts would be very much appreciated.  I was in Boulder for the last Word Press Camp there.  Enjoy your day, Bob, up the road in Lander, Wyoming

    • Hi Bob,

      The home page link is either set in your theme’s header.php file OR more likely under Appearance > Menus. So you probably want to remove the Home like you created previously for your custom menu and add a new custom link to the home page and save your menu.

  105. This is exactly what I need to do, except when I try to do it, I am getting the following error when I load the main “” page:
    “Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/hihp0312/ on line 17

    Fatal error: require() [function.require]: Failed opening required ‘./wp-blog-header.php’ (include_path=’.:/usr/local/lib/php:/usr/local/php5/lib/pear’) in /home/hihp0312/ on line 17″
    There was a previous Joomla installation and there is no www, htdocs, public_html, or httpdocs folders that I have unearthed after hours of searching. I thought I had the file in the right root directory, but perhaps I don’t. Any help you can provide would be immensely helpful. Thank you. 

    • Hi Jen,

      You may have missed a step. Please read the FAQ for this blog post and check that you edited the index.php file correctly after you moved it to to the public_html directory. Please reread the instructions carefully. The error you are getting is related to the index.php file not finding the folder in which you have WordPress installed, and the require line must be edited correctly according to the instructions in the post.

  106. this is still very complicated, compared to what was said about moving one file, one line of code and one modification!  I might need someone to hold my hand while I do this because those instructions are foreign to me lol

  107. THANK YOU, THANK YOU, THANK YOU!!! If it weren’t for passionate individuals such as yourself… where would we be??? :-)
    Your assistance has been greatly appreciated!! Bonnie

  108. Hi,
    Thank you for the above instrusctions. They’re detailed and will certainly assist me. However, I seem to have ‘lost’ my old static site. It’s no longer in the public_html folder but somehow is still live. :-) help!!

    • I don’t know what you mean be “is still live.” Does that mean you’re finding it in a Google search or you see it when you visit the site in your browser window? Have you tried deleting your browser cache? It will take a few weeks for Google to re-index your site and no longer show the old page URLs. It helps if you install the Google XML Sitemaps plugin and submit the sitemap via Google Webmaster Tools.

  109. On my win2003 server with PHP5,  I was getting a white page for my blog until I changed the line in the index.php file at the root of my site (not the index.php file in the blog directory) to the following:    Note the deletion of the “./” right before “mywp”.  It’s working great now.

    • Your text got cut off in the comment, so I don’t know what you changed your index.php file to, but yes, you are supposed to edit the index.php file in the root of the site not in the sub directory. The copy of the index.php in the subdirectory doesn’t have a function after this process has been completed other than to prevent reading of that directory.

      I have never seen the index.php work properly without the ./ before the sub-directory name. That wouldn’t make sense in a normal hosting environment. Here is what the require line is supposed to look like (where blog is the name of the subdirectory):


      So, interesting that yours is working as:


      on your server. I would think that would break it unless there has been a typo to begin with. I don’t know anything about Windows server hosting. I usually recommend people avoid hosting their WP on Windows because it usually results in a lot of problems, including difficulty with permalinks and plugins.

  110. I have been looking for an answer for my question and I think I found it or near enough but need some clarification first. Right now I have a static html site that I host on Hostmonster and currently use WordPress for my blog so it’s already installed. I would like to remove all the old files and create a new website in WordPress (all new pages, nothing from the old site will be kept) but keep the blog content as my blog. I have installed a new theme and am ready to design.
    When I am ready for my website to go live I will remove the old html pages from the root directory, follow steps above to move WP from sub to root directory and deactivate the maintenance plug-in. All things being equal everything should be cool. Since I am moving WP to the root directory will my blog still be my blog and my website be my website on the WordPress platform? Or do I need to do other steps?

    • Hi Grace,

      Is the only WordPress you have installed the one in the sub-directory? It sounds like you might have two WordPress installations. Please let me know then I can advise you.

      The easiest thing would be to just use your current blog WordPress installations and create the static pages on that installation of WordPress using the new theme, etc., but then, if you’re using the maintenance mode plugin, people won’t be able to see your blog. That’s why it sounds to me like you are working with two different installations of WordPress.

      • I think you might be right. Under the public_html there is a blog folder that includes wp-admin, wp-content and wp-includes. 

        In the public_html/RedBarn-Studios folder (where my current & soon to be old website files are) there is another folder called blog_2. If I remove this whole folder (RedBarn-Studios ) completely I assume that the blog pages I have designed will be deleted as well?

        • Hi Grace,

          I don’t know how to advise you at this point, since I don’t know which WordPress install is being used for your content, and it actually sounds like you have 3 copies of WordPress installed. If you want to hire me to sort this out for you, I can be reached at Do you have two or three WordPress logins you are using – one for each of the sites? If you do, you need to pick the one you will ultimately be using for the live site, and login to the other one that contains your posts and go to Tools > Export and export all of your post content and then go to Tools > Import on the version of WP you want to use when you’re all done with your development and import those posts, so you have everything in one place. Don’t delete anything until you’re positive you have ALL of your content in the correct WP install. I have seen people do this before. They sort of get carried away with the one-click installers at their web host and forget all the places they’ve installed WordPress as they attempt to development work on a new site.

  111. Angela – as always, thank you for your simple instructions

    I was able to get this to work on a site of mine before, however, the WordPress contents interfered with some ASPDotNetStorefront contents, so it was either/or (by switching out .htaccess files)

    However, we have now MOVED all of our ASPDNSF contents to a subdomain/subdirectory “store”, and the root is completely clean except for 4 directores

    And now I want to complete my original intention of having my WP contents show up as domain homepage and normal pages

    I got the homepage to load, and nav links are written correctly (without the /subdirectory/ showing in the link)… BUT I get the “”The system cannot find the file specified”” error when clicking onto navbar links to inner pages

    I made sure to MOVE .htaccess over from subdirectory to root, and to re-save my permalink settings, but no go

    Im thinking it has to do with me not doing exactly how I first tried (when successful) and possibly regarding COPYING vs. MOVING the index.php file and/or the .htaccess file

    Just to be sure, I am supposed to essentially have TWO index.php files, one at root and one inside subdirectory where all wp contents are… correct? and with that, should those index.php files be identical? Im guessing they shouldn’t since your instructions say to download original, edit, then upload edited to the root – so it should be like this right?:

    index.php in root should read:

    index.php in subdirectory should read:

    I also tried the Silence Is Golden index.php within the subdirectory – still no go

    I also tried having the .htaccess file BOTH in the root and subdirectory, made sure to update permalinks settings. Nothing.

    Any ideas?

    It might be something entirely different, being as this is a clients site hosted on a Windows host (booo! but he is running .aspx so must)…might be something else interfering

    However, I was able to get it to work BEFORE, when the aspx stuff was at root, so I figured that after moving it to subdomain and root being clean as a whisle, that the WordPress would work perfect 

    thanks so much for your input

    • Hi Jesse,

      Are you hosting on a Windows server? It sounds like you are if you’re also hosting an ASP store. If you are on Windows, you will need to contact your web host about how to manage the permalinks, because .htaccess with the rewrite mod is an Apache server function, not a Windows server function. If you read my FAQ which is linked at the bottom of this post, I do have some info about Windows permalinks on there.

  112. found it further down on your blog. my .htaccess file wasn’t writable and I had to save it manually.  i all works.  thanks for your WP mojo!

  113. Thank you for these tips! I moved everything over and followed your instructions.  The landing page loads fine but the interior pages are not showing. I move the .htacces file to my root. I opened up my .htaccess file and there’s nothing in it.  It’s file that was installed with WP by my host.  I guess there should be some redirection code in there but I’m not sure what if anything. Thanks for any light you can shed on this.  

  114. Thank you for your prompt response.

    After a bit of googling I found the relevant WP Codex page ( to say “If you have installed WordPress to a subfolder, such as wordpress, don’t forget to add the folder to the link URL”. That is precisely what I have had to do, so perhaps I’m stuck with it!

    Cforms survived the procedure with no problems despite your dire warnings. I’ll investigate further about the password plugin, but maybe I’ll have to abandon that one.

    Many thanks; great post!

    • When you follow these procedures, the URLs for categories, posts and pages do NOT include the subdirectory. However, when WP is installed a subdirectory, as I wrote before, all of the images and uploaded files DO need to include the subdirectory in the URL, because the wp-content folder has not moved — it is in the subdirectory.

      • I should add that for people who follow these instructions precisely from the beginning and haven’t done other things previously to change the links on the site, then they do not have to worry about any links being broken, except for manually created internal links to pages or any custom links in the Appearance > Menu.

  115. Thank you! After hours of trawling through numerous over-complicated instructions and laboriously undoing all the changes I had made when they didn’t work, I came across your clear instructions which made sense, and worked first time. However, I still have a couple of problems………

    My links to uploaded media files such as pdf files were broken and I could only get them to work if I manually re-inserted the subdomain name into the link realtive URL. This worked, bit is there another tidier way to restore these links?

    More importantly, in my subdomain I had a plugin called Exclusive Password Content Protect which hides certain content unless a password has been entered. The password entry box still shows, but entering the correct password achieves nothing. Any suggestions?!

    • Hi Henry,

      Not knowing what you may have done or not done to break your links, I can only say that:

      1) This process will NOT break ANY image or uploaded file links.

      2) If your links are broken, it’s because of something you tried to do previously to “move” WordPress and perhaps rewrote your links in that process.

      3) If WordPress STILL resides in the subdirectory, then all of the images and uploaded file links should still contain the subdirectory in the URL, eg.

      As far as the plugin again, the same applies there — it should work fine but some plugins don’t have the paths defined correctly and insist on looking for WordPress in the site URL rather than WordPress URL, so that would need to be changed in the PHP code of the plugin if that’s the case. You can Google that plugin and see if people have issues running it from a subdirectory. Cforms has this issue as well.

  116. Hi, I am working on a new wordpress site that I will eventually move to my main domain name to replace my old static site. Your instructions on moving it are very helpful, except I have one problem: I can’t find the line  any where, on my index.php or on any of the index.php files that are with some of the included themes. What do I do or where do I find this?

  117. Hi Christopher,

    I use HostGator a lot. The issue with the .htaccess is easily resolved by going to Settings > Permalinks and clicking the Save Changes button. This automatically rewrites the .htaccess file after you’ve done the “move.” This is not a HostGator specific issue. It’s more that sometimes your .htaccess needs to be rewritten and the simple Save Changes on the Permalinks page will do that on good hosts such as BlueHost and HostGator.

    Good to know about the Silence is Golden Guard plugin. I assumed it created an index.php in the WP directory, but if it doesn’t then I shouldn’t recommend it here and instead people should just download the blank index.php file from the wp-content and upload that into the WP directory — or WordPress recommends copying and not moving the index.php that’s there.

  118. You have the site installed in a subdirectory and when you to go the root URL you want it to REDIRECT to the subdirectory, so you really DO NOT want the URLs to display from the root, you want them to all display from the subdirectory and when you go to the home URL you want it to show the subdirectory not the root URL? Correct? If that’s the case, return your Site Address (URL) back to how you had it with the subdirectory name and then use .htaccess at the root to redirect the root URL to the subdirectory.

    You are doing the opposite of what most people want to do, so you should not follow any of my instructions in this post and instead leave everything in the subdirectory and use .htaccess redirect the root URL to the subdirectory URL.

    Most people want to get rid of the subdirectory in the URL and show all the links from the root, so that’s why my post is not helpful to you.

  119. Hi Angela, I have a different problem that I hope you might be able to shed some light on? When I first installed wordpress I did so on a subdirectory. Thinking I knew what I was doing I then copied this folder to my root to make this my websites directory. As your post so eloquently illustrates this did not work. So I resumed using the subdirectory as the root of the site. The site has grown in time and uses many plugins. I now want to consolidate the site and get rid of the extra files that were made by my previous attempt. The thing is, the site seems to use some of these files. So when I delete these extra files on the root of the server it breaks the site, even though the sites root is in a subdirectory. Is there a way of finding out which files the site is using in this directory, so that I can consolidate the site and then move it using the method you have written?

    • Either the site is in the subdirectory or it is in the root. Now you say you have files in both the root and subdirectory. That doesn’t make any sense. WordPress will look in one location for the files, so you should check your Settings > General in WordPress and see what those are and write back. Also, see what is in the index.php file. Why are there any files in the root if you moved them all back to the subdirectory?

  120. i want to have my site which is installed at http//  wordpress is installed in this location as well as my theme. it works prefectly but i want it so that when you type it shows the new wordpress site in the security_division folder

    Your instructions seem so simple but  i keep getting

    Not Found
    The requested document was not found on this server.

    so i changed the index.php file to this

    this index.php file is a copy which was in the folder security_division

    i also changed my general settings to:

    WordPress Address (URL)

    Site Address (URL) :

    so i belive thats all i have to do but it’s not reading anything.

    i have the old site up and changed the index.htm file to indexold.htm just so it wouldnt get confused . i put it back because the owners woulud freak if they see no site up.

  121. Thank you for this post. I carefully followed the instructions and got it mostly working first time. I was using it to convert an old static site into a WP site, and I wanted to learn how to install WP in a directory.

    My problems came from the fact that I use Hostgator. The site would not work internally with WP generated .htaccess file not in root (public_html). But when you move it to root it still has the reference to the installation folder in it. I edited in TextWrangler and uploaded it to the WP subfolder then copied over the top of the generic .htaccess that is created by the hosting. Bingo, everything worked.

    I tried the silence is golden plugin, I must be dense because I could not get it to create an an index.php for the the WP folder, but it seemed to create one everywhere else. I ended up just doing in TextWrangler and uploading using my host’s file manager program.

    Overall, a good experience, and I think I will do all my WP fresh installs in directories, not in root. Thanks.

  122. Excellent, straightforward steps. Something I was worried would cause me a headache was completed in a few minutes thanks to these instructions.

  123. You are a life saver…so far! I’ll check back in 10 minutes to see if it’s still working…

    Your directions are VERY COMPLETE and easy to read. Thank you!–Ana

  124. PERFECT! Easy to follow instructions that Ditto shannon.

    I do have one issue, which began on my first attempt at this from another person(ugh) None of my images are showing up. The place holder is there and the link at the bottom display the original path to the image but no workie :( Any suggestions?

    • Hi Maria,

      It’s hard for me to say what the problem might be because of someone else having gotten in there, and we don’t know what they did. You can read the FAQ I wrote on this process, but I’d probably need you to send me the URL to the site, so I can see what’s going on. Are you still accessing WordPress via the sub-directory? What are the URLs to the images?

  125. Thank you so so much!  This saved me so much time and now I am going to create all of my sites in a subdirectory.  Do you know if I will run into any problems in I install a wordpress landing page in the root, and then delete all those files before I go to move the fully developed site from the subdirectory to the root?  Thanks!  I’m off to make a donation for your excellent help!

    • Hi Kimberly,

      Thanks for the donation! You can use one of two plugins (see below) to create a temporary “landing page.” You’ll want to follow the instructions in this post first, though, so the landing page plugin works. Otherwise, it will just show up in the sub directory.

      When you’re ready to go live, you’ll simply disable the plugin.

      You can try them each out and see which one you like better. I think they each allow you to specify a custom-designed html page or have options for styling their landing page.

      • Thanks so much for that advice.  I will take that into consideration on future creations.  For my current site, however, I already installed a landing page plug-in at the root (along with a wordpress install), but I am working on my actual site on a subdirectory.  I’m wondering, is having an install of wordpress at the root going to cause any problems when I go to make the transfer?  And do I just delete all the files in the root at that time to make the transfer?  A little clueless.  LOL. 

        BTW, your advice from this blog post worked beautifully for a site I was just working on for a client!

        • You are so smart! For the site where you have WP in the root and WP in subdirectory, you’ll want to delete the WP in the root and then follow the steps in my post.

          You might have to go to Settings > Permalinks to save those again so the .htaccess in the root gets reset properly.

          Glad everything worked out with the other site! The only problems I’ve seen are with extenuating circumstances — such as Windows hosting server, mistakes, and people leaving their old files in the root.

  126. I’ve got a lot of subdirectories on my site for forum and CMS applications and had previously linked to these from a static webpage in the root directory. This is so much easier and neater. I like the clarity of your instructions and the layout of the site.
    Thanks for your work.

  127. All I can say is… THANK YOU! I must have read every tutorial on this topic over the past three hours and no matter what I did, I couldn’t get it to work until after reading yours. It was your well-written, highly-stressed #FOUR tip that solved this problem for me. Because I named my sub-folder wordpress like so many people do, I was actually changing the /wp to /wordpress, instead of just adding it in front of the slash. Blame it on my tired eyes or maybe not paying enough attention, but you spelled it out so beautifully and made it easy to  see what I was doing wrong. This was my first time designing a WP site to take over a client’s static html instead of starting from scratch, and I was already a little nervous about the process. With this info I will definitely be leaving the WP files in a sub-folder from now on to keep things nice and neat. Thanks again for making it seem less scary! I will be bookmarking your site to follow for the future! :o)

    • Hi Shannon – That was the best written testimonial I’ve received yet! I’m glad that the highly stressed #4 was helpful. After receiving hundreds of comments on this post and helping people personally do this, I’ve rewritten the post plus wrote an FAQ, because I would see the same mistakes over and over again. It’s those simple things – like syntax – that can make things go wrong. I’m guilty, too, of “tired eye syndrome” and simply having a misplaced ; or ‘ in my code. Good luck! I’ll be writing more helpful posts over time.

    • Nice to meet you, Brenda. I hope to write more soon. I’ve discovered some awesome WordPress themes that make development so easy that I’ll write about along with how to migrate WordPress to new host or from development site on a local computer to a new site, etc.


  128. Hi Amanda,

    I use Gravity Forms on just about every site I create, and I’ve never had this problem. If you think it’s the Silence is Golden plugin, then de-activate that and just make a copy of the index.php file you find in the wp-content folder and put that in the root.

    I don’t think the Silence is Golden Guard plugin should cause this problem, but I do know someone else who had some weird issues and we disabled it as a result.

    Check over all your settings again just to be sure you didn’t leave a forward slash at the end of your URLs in the General Settings. Email me via my contact form at if you still have trouble.

    I would perhaps suspect more greatly that you need to clear your browser cache and perhaps you should reinstall Gravity Forms — perhaps you updated it at some point and one of the files didn’t update all the way. One person who wrote to me had issues she thought were related to this “moving” process but were really because she had just updated a plugin, and the update didn’t completely properly.

  129. Hi Angela, Your way of explaining this process is fantastic, I have used it numerous times with absolute success. I have come across a problem with a site I am working on currently, within a plugin – Gravity Forms. All the internal hyperlinks, images, everything, works perfectly from the subdirectory install for every other plugin and image. Except within one area of the  Gravity Forms plugin which is a link to a modal window from with the plugin dashboard.  It returns the white screen (as as I have Silence is Golden running). If I don’t have Silence is Golden running then the sites index is listed. This modal window is meant to be a editing window, like a image edit window. I have been in touch with the Gravity Forms Developer, but they seem to think its the install? Have you come across any issue like this before? maybe have some tips?

  130. Can I still tweak the site (the theme options, for example) and add pages and posts after I’ve gone through the process above?

    • Hi Lily,

      Yes, it will work exactly the same as it does now. This simply allows the URLs to show from the main URL of the site, but WordPress is still in the sub-directory, so you will access WordPress via the same URL do now.


      • Hey Angela, Thanks so much for the quick reply. I actually went ahead and did the process myself and saw that it is indeed editable. All went very smoothly, perhaps because i followed your directions to the letter. They are so well written. A million thanks!

        BTW, I’m “Angelynn” and you can see my site now at

        I’m going to make a donation in gratitude.

  131. Thank you for the great post. I had a similar issue and helped me but now  i see another problem. i cannot access my posts via the menu and get white/blank pages..any idea how to fix this?

  132. Angela, great post, really, thank you very much. You can tell how good a post it is by how many comments it receives WAY after it’s been posted! You wrote this a year ago people are making use of the info to this day! This guide really freed me up with a client; thanks again.

    • That’s awesome, Daniel. Thanks for the comment. I have been keeping the post updated since I wrote it, and also wrote an FAQ based on all the comments. It’s amazing how many hits it gets, and I know people get really stuck with this and have some urgency, so I try to be responsive. I might make a little video! I also am in the process of writing a post about how to migrate WordPress from one server to another using BackupBuddy.

  133. WOW!  This is awesome!  It worked just like you said.  Now, is it possible to move the ‘image’ directory by itself to the root to completely protect the location of the install?  Thank you for all the help. :)

    • I did read a post somewhere (perhaps on Perishable Press) about being able to locate the wp-content and/or uploads folder to a different location, but it didn’t always work with specific plugins. So, I wouldn’t take the chances. It’s so easy for bots to find out “where” WP is installed, that it’s hard to totally obscure it and your site, if it gets hacked, is going to get hacked via a plugin or theme NOT WP core. The best you can do for security purposes is to be cautious about what plugins you install, keep everything updated all the time, and do regular backups of your database and wp-content folder using a plugin such as BackupBuddy (my affiliate link: Glad the process worked!

  134. I’m just curious about reason #2 (extra security layer) as far as why you recommend placing WP in a subdirectory; wouldn’t it be as simple as copying the source URL of an image file on the site to realize where WordPress is installed?

    • Yes, true, but some bots are programmed to go to or All the images are still viewable via the subdirectory, so it’s not a big “secret” where wp is installed, but can fool some bots looking for wp app files in the root.

  135. Hi Wp Girl,

    Currently my Wp develpoment site is in a seperate directory of the site root directory. The old site, which I will be removing, is in the root directory.

    Your instructions are the most lucid I have come accross, but I found almost identical instructions at, and there seems to be a conflict.

    You say, “MOVE (do not copy) the index.php file,” and the other instructions say, “Copy (NOT MOVE!) the index.php.” In addition, the other instructions mention moving the .htaccess file to the root directory. Can you comment on this?

    I could just experiment a little, bu I am fearful of digging a hle I can’t get otu of.

    • They suggest copying instead of moving, because when you move the index.php file from the subdirectory it leaves your subdirectory without an index file meaning that visitors can look at all the files in that directory. I have had best success with moving the file. If you copy it, people often edit the wrong file, try to access WordPress in a way they shouldn’t, etc. It’s just messy to leave a copy in the subdirectory.

      After you MOVE the file, you’ll want put a blank “Silence is Golden” index.php file in the subdirectory so people can’t view your subdirectory contents. I describe how to do this in this post. You can find a “Silence is Golden” index.php file in the wp-content folder, the themes folder, and the plugins folder. It is in all of those folders to keep people from seeing the contents of those folders. If you open one of those index.php files, you’ll see some text that says “Silence is Golden.” It just is there as a non-displaying comment and results in a BLANK page being displayed when someone goes to the URL of that directory. Try it.

      So, the instructions are not “wrong” per se, they are just not “correct” if you want to do things cleanly. I think they realize most people can’t handle too many steps in a process and don’t want to leave the subdirectory without any index file for security reasons. Make sense?

  136. Hi WPGirl,

    I would like to change my existing site substantially but need to work on these changes while the current site remains up for users.  The switch from current site to new site would need to be pretty seamless in timing.   Is it right to assume a second wordpress install to a subdirectory is a good way to work on a new site while the current site is up? 

    Would your instructions above allow me to ‘move’ the new site in the subdirectory to the current/old sites url?  Sorry if my language is fuzzy but I’m obviously a bit green here, hopefully you understand what I’m asking :) 

    With that said, where would the best instructions be found for installing wordpress into a subdirectory?  I ask you simply because I want to make sure I set this up properly for your instructions!

    Thank you for your time,

    • Hi Bobby,

      Yes!!! That is exactly what I do for current clients. Right now, I am redesigning a site for a client, so I used BackupBuddy plugin ( and I did a full backup of the current site, created a new blank database, and then ftp’ed the backupbuddy backup plus their importbuddy.php script to the subdirectory where I’ll do the development on the new site, then ran the importbuddy.php script via the domainname/subdirectory/importbuddy.php url.

      The beauty of backupbuddy is that it will update ALL the links and URLs, so they reference from the new location of WordPress in this new subdirectory.

      So, then after you’ve “migrated” your current installation using backupbuddy to the new subdirectory, you can do all your modifications. When you’re finished, you can follow the steps in this post to have the pages from this subdirectory installation display from the root, so you all of the URLs will match the URLs as they currently are on the old site with the exception of images, which will all link via the subdirectory URL.

      The beauty of this process is that all of your image links will not be effected when you do the “move.”

      So, definitely use BackupBuddy to get the copy of the current site duplicated in the subdirectory correctly — unless you’re basically blowing away the current site and are starting fresh.

      Feel free to email me via my contact form if this is at all confusing. Once you’ve done backupbuddy migration a few times, you can do it in your sleep or like I do — in a sort of half awake over-caffeinated zombie like state.


  137. Pingback: And, Wordpress hackers, just in case you’re interested… | Computer Floss

  138. I am updating a site for someone who originally had another person working on it.  He is not knowledgeable with website development.  I have never used WordPress before this.  Well, today I was playing with a URL change to just point to a different page.  I went back afterwards to the General area and changed it back since it didn’t work.  However, now I can’t access WordPress at all.  I get the Internal Server Error.  I don’t have access to the PHP area on my computer to change anything in the database.  He doesn’t even have the WP install on his computer.  I guess the previous person did all that.  So, is there anyway for me to fix this or anyone who I can contact to do so?

    • You will need to get his web hosting control panel and FTP access to the site. Once you get the web hosting control panel access, you can login to phpMyAdmin which is an application you’ll see in the control panel. If it asks you for a password, you’ll need to have the FTP access to the site to find the database username and password in the wp-config.php file. Read the FAQ I have to this post for more information. Email me directly via my contact form if you get stuck. I charge $75/hour for support, and generally these issues are resolved in under an hour — usually 15-30 minutes.

  139. Thank you for the nice tips . I have followed the steps in “How do I move WordPress from a subdirectory to the root directory?” and my pages still show url inside the subfolder. Do you know why?

    • Hi Walter. Looks like you didn’t follow all the tips exactly. Please read the post again and then perhaps read the FAQ and make sure you got it all step-by-step. Also check your permalink structure. Should not include the sub-directory name in that structure.

    • Hi — Try to set your permalinks to the default and see if the pages work and let me know. Then, I can tell you what to check next.

  140. Happy New Year, Walter and Chris. Thanks for the greetings. Cheers! You’re music is wonderful. I love it! I volunteer with a West African dance/drumming festival and visited Ghana a couple years ago. I’m a big fan of Ry Cooder, and your music reminds me of his CD Talking Timbuktu with Ali Farka Toure.

  141. Hi Grey, It sounds like you’re really on top of your content needs and thinking ahead of the curve. I don’t know if multi-site is the solution for you or not, but I think custom post types could be an easy way for you to go. Though it sounds like you want to limit searching to just within the custom post type of the product they care currently browsing. There are some forum posts on on on how to limit searching to specific custom post types, but then you’d want to create multiple searches. I’ve been using drop down taxonomies for something similar — so they can pick the “product type” they want from the drop down, and I have 5 different ways products are categorized. So you may need more custom taxonomies rather than custom post types if that makes sense. Good luck!!!

  142. Hi Charlene,

    Two things:

    1 – With this process, you will still login at the full URL that includes the subdirectory because the WordPress application is still located in the subdirectory. We did not move WordPress, we simply made the page and post links display from the root.

    2 – To avoid having people index the subdirectory (ie to keep the subdirectory contents private), you need to follow step 7 on this blog post:

    Good luck!

  143. Angela the Angel – you completely made our day! Thanks sooo much for your clear, generous directions. We followed them, problemshot with your FAQ, and Voila! All is well at the new Happy New Year to you –>>… Walter and Chris

  144. Thank you! I’m new to WordPress and .php, but I just wasn’t comfortable following the instructions at I followed your instructions and it worked like a charm.

  145. Thanks. This is exactly what I need to do with This site is long in the tooth, but still gets a lot of visitors, so building the new site first in a subdirectory looks the ideal solution. Also great idea about hiding the WP install. I have had a site attack earlier this year. The host said that they had secured all their WP sites now, but this would be another layer of security.
    Finally, one question about using sub directories for a multi product site using custom post types for each product section. I am about to use a listings theme with custom post types and a multi filter search box. For a niche site this would be perfect. But I am thinking of also making a multi product site, where the searches would be unique to each “custom post type” Is it better to use multisite for this, and how would I go about the install, and setting up the sub directories?

  146. Thank you Angela. It took me all of 10 seconds to find your article in a google search, and now I’ve got a clear map on how to do the switch once I’ve got my blog set up (which was a migration from Joomla). Nice to know I can leave it in the subdirectory. Joomla was also in a subdirectory.

    Actually as I write this, one question comes to mind. My Joomla site was in . I was intending to have wordpress in and then follow your directions for having it function with the root url But now it’s got me thinking… would there be any advantage is actually having it in (the old Joomla location), obviously after I have decommissioned the Joomla site and removed it from that location?



  147. Hi there,

    Thank you for an excellent ‘how to’.  As a new wordpress blogger, I was quite perturbed to find myself displaying my root www directory when I went to my site.
    All sorted and working thanks to you.

  148. Thank you, thank you, thank you!  You saved me so much work.  I am so happy I found your post.  I tried to do this the hard way, and wasted hours.  If only I had found your solution first!

    • This process I describe is NOT for “moving” aka “migrating” WordPress. This process is for deliberately installing WordPress in a subdirectory (for development purposes) and then having it show in the root. You do not need to touch the database or “move” anything other than the index.php file.

      For “migrating” WordPress, I recommend that people purchase BackupBuddy ( which does backup the database and the files and allow you to easily migrate the site to a new server. It can also be used to schedule regular backups of the site to cloud storage or other FTP server. I’ll check out this free plugin, too! Always nice to know about these tools.

  149. My instructions assume that people are running on an Apache server rather than some not-so-friendly web hosting package such as Windows or Zeus. Apache/Linux is the best environment for WordPress and WordPress plugins to run. If the host is not running Apache/Linux, then permalinks do cause an issue, and you have to check with your web host about how to enable the rewriting of the IDs to the pretty permalink structure, whether via a web.config file on Windows or the Zeus rewrite you mentioned for Zeus servers. I’ll be sure to edit the post to differentiate these different hosting environments.

    This post is primarily about “moving” WordPress, but in the process, people will activate the pretty permalinks and have them not work and assume it’s because of the “move” when it was because they didn’t realize that their host didn’t support permalinks for Apache server.

  150. Hi,
    My WP installation is in a sub-directory and I want to move to the root. But my server is Windows 2003. Can I follow the same steps? Please advise.
    Thank you.

    • Hi Aneesh,

      This process will work just fine with the possible exception of the “pretty” permalinks working as expected. Do you have permalinks enabled on the current site or the default permalinks (Settings > Permalinks)? The nice thing is that you can certainly try the process, which if you follow exactly only takes a few minutes. If it doesn’t work, then you can reverse the steps by first changing the General Settings back to what they were and then moving the index.php file back to the subdirectory and editing it again.

      Please read this post from the WordPress codex on enabling permalinks on Windows:

  151. Hey… I went through this method Step by Step and It worked!! But however, my comment form is missing from my posts ever since. I do have the “Leave the Comment” still on my page. please help.

    • Hi Jeanteena,

      Wow, that is strange. It sounds like perhaps there is something with the theme not knowing where to find the comments template. That usually shouldn’t be effected by the subdirectory change. Do you want to zip up your theme file and email it to me? If you email me via my Contact form, I can reply to you. Some themes are not coded properly, and they have URLs to their internal template files that are relative to the wrong thing.

  152. :( I followed the instructions exactly and all I’m getting is a white page that says I can’t access the site. Any ideas?

  153. WOW! I normally don’t take a woman’s advice on most things, but I have to say; this reads well so far and seems to make sense. I’ll be trying this out as soon as I’m done with my project.

    • I’m not sure if I should be flattered or offended. Why in the world would you not read technical documentation by a woman? The ability to write technical documentation has nothing to do with someone’s genitals. Men are just as capable of writing total crap as women are. Anyway, I’m glad it will be helpful to you.

  154. Hi, I tried implementing this but got this message:
    PHP Warning: main(/index.php): failed to open stream: No such file or directory in D:Domainszzz.comROOTInetpubwwwrootblogwp-404-handler.php on line 7 PHP Warning: main(): Failed opening ‘/index.php’ for inclusion (include_path=’C:WINDOWSsystem32inetsrvphppear’) in D:Domainszzz.comROOTInetpubwwwrootblogwp-404-handler.php on line 7
    wp-404-handler.php is used as I have Windows server and IIS. wp-404-handler.php is in the sub-folder blog:-
    How to change the index.php in this to the new file in the root?

    • Hi Paul,

      Hmmm…. I have no idea where to start here. I’m working on writing an FAQ, because the only times I’ve seen this process not work is when someone doesn’t follow the steps exactly as written. So, first answer the following questions for me:

      1 – Where did you put the index.php file and what do you have in the “require” line of the index.php file?

      2 – Are you able to login to the WordPress Dashboard?

      What is your domain name? You can certainly email me directly via my contact form.


      • Thanks, I’ve emailed separately but had missed out the important step 2. Now the PHP error message goes away but the permalink, without the subfolder in the URL, cannot be found. It goes to our custom site-wide ASP error file, and not the error file created for the blog folder only, wp-404-handler.php, in cases like this where Windows hosting does not allow .htaccess rewrite.

        • Hi Paul — WINDOWS HOSTING – run as fast as you can! It’s truly horrible, but you should talk to your web host, because they can enable this functionality on the server. It’s not impossible, but they will need to do it. Give them a call and see what they have to say. In the meantime use the default permalinks. I think if you move the .htaccess to the public_html that might help, and you may need to include the /index.php in the permalink structure. Here are more details about the permalink structure you can speak with your host about:

    • The WordPress Address URL is the URL where the WordPress application is located. The Site Address URL is the address from which you want the pages and posts of the site to be displayed from. The purpose of this post is to show you that you can have the WordPress URL be in the subdirectory, and the Site URL be in the directory above that (ie the root website address), and still have WordPress work. The trick is to move the index.php file that’s in the subfolder where WordPress is located to the parent folder and then edit it to show where WordPress is located. See the instructions in this post for more details.

  155. hey girl.. i have alot of questions since it are so good in WP.. i hope its ok to ask it here…

     umm i have a webhosting server on Ninja Lion and im using 2 domains on that server..its ok right? thats the first question :P lool

    2nd, im going to link my website on a facebook page..but the problem is ..that the posts i made on the site have a featured imaged as usual..these images do not appeare on fb when i post them.. how can that be fixed? any plugins to suggest?

    3rd, how can i change to so to be more secured?

    4th.. .htaccess should be configured manually ? or by it self..although i know nothing about it.. 

    those are few questions.. yet i have more.. but i dont want to bother you alot hopefully im gonna solve the rest..if not..then i have to ask you again lool :). sorry for bothering.. thanks alot


    • Okay, MadBoy, I’ll try to answer your questions here simply:

      1 – Hosting. Most web hosts do allow you to host unlimited domains on the same hosting account. You have to find out if they “throttle” your bandwidth at all based on hits or downloaded content. Otherwise, it’s fine.

      2 – When you manually post a link to your website on Facebook, it looks at any of the images on the page to use as the post thumbnail. However, if the only images on the site are background images in the CSS, then it won’t find an image. It actually has to be an image inserted on the post/page or sidebar — not in the CSS.

      3 – I don’t think I would bother. There are many other things you need to make your site more secure, such as have strong passwords, use a backup plugin like BackupBuddy (, don’t use vulnerable themes and plugins. There are too many ways a hacker can figure out what directory your files are in, so other security measures are more important. You’re not going to prevent your site from being hacked if you are using a vulnerable script or plugin simply because WP is in the subdirectory.

      4 – A couple purposes for the .htaccess: 1) to make the pretty permalinks work. Usually clicking Save Changes button on the Permalinks settings page will auto generate the .htaccess file. If not, you can create it using an ftp application that is set to view invisible files and give it 644 permissions. Then WordPress can write to it. 2) to make your site more secure, manage page cache, and do redirects. For security, you can try the BulletProof Security Plugin which locks down the WP site via .htaccess.

      I hope that helps!

  156. hi

    I have a number of hand coded links in pages that refer to the test directory.

    Like to buy a print of
    this image?

    What is the best way to update these, through the DB?

    • You can use the Search and Replace plugin to replace these, but you have to be careful to search on a href=”…. and not just on the url because then you’ll inadvertently ruin all your image links. To be safe, do the search and replace on the hrefs then do a search and replace again to replace with — which is correct for your image links.

    • Very good. Be sure to check any internal links to pages you may have made, so they link to the new url for the pages.

  157. Thank you, Thank you.  I found myself in the same hiccup as Vanessa below as I wrote the wordpress directory as the subdomain ie rather than  It is now up & loaded and only took a couple of minutes after fixing my error…. You’re my hero WP Girl!

    • Awesome, Shannon. I need to get cape! Actually, I need to write an “FAQ” on this process to address all these little things. Coming soon!

  158. Thanks for the information-I followed your instructions and was able to get my WordPress blog to the root level of my website. The instructions were very helpful to me-  Connie

  159. Hate to be mooch-like but I have a slightly different situation, not sure if the same would apply.

    I was rebuilding domainB on  it wasn’t a subdomain or subdirectory of the same domain.  it’s a long story as to why but i went to do a switch of the URLs from the general settings, and everything got messed up.  now things are switching randomly and domainB doesn’t look normal, I can’t log in to either wordpress backend now. 

    I almost just want to start over.  Leave domainB and alone and do it some other way.  Would I follow this same set of rules since it’s not a subdomain or subdirectory?

    • Hi Vanessa,

      I’m about to write an FAQ for this process, because there are a couple places where people can make a mistake, and if they do, they need to know how to fix it.

      To get back into your wordpress on domainA, you need to login to your web hosting Control Panel and go into your phpMyAdmin application and look for the following two URLs in the wp_options table (Browse the table):

      option_id 1 – siteurl — you should probably just set this back to

      on page 2 of this table you’ll find

      option_id 37 – home – set this back to

      Now, hopefully, you’re back go square one (if you moved the index.php file you can move that back into the subdirectory and get rid of the edit you may have made to it). Now, it sounds like you need to MIGRATE your WordPress installation. This is different than what I am describing above. You will actually need to MOVE the entire WordPress installation from domainA to domainB’s hosting account. To do this, the easiest way is to purchase BackupBuddy plugin and backup to a zip file. The BackupBuddy zip file will contain a backup of the database and all the FTP files.

      At domainB, you need to create a new database with a user and password. This database needs to be blank – ie don’t install WordPress on the new host. Write down all the details for the database. Then, you need to ftp the BackupBuddy zip file along with the importbuddy.php file that you can download via the BackupBuddy interface on BackupBuddy has a great video tutorial on this process. It’s quite simple and is the best way to migrate a site from one domain to another, either on the same server or different server.

      Here’s my affiliate link to BackupBuddy:

      When you use BackupBuddy, you can just install the new site in the public_html directory of domainB, and it will correct all the WP settings and URLs for you, so you don’t have to worry about the process I’m describing in this post at all.

      • Woman, you rule.  Total girl crush on the WPgirl.  I was able to reset the info in phpMyAdmin so now I don’t have to worry about getting fired at work tomorrow!  I’ll tackle the second part after some much needed, bleary-eyed sleep.

        Seriously can’t thank you enough!!

  160. This is great! And thanks for the info. I have a question if you’re still open to answering.

    I am stating my site in a directory and about to go live. I realize now that I want to change the name of the directory that it’s sitting in; and still follow your directions to access from the root. But I’m worried that I’ll break all the intrsite links and images if I simply change the name of the directory via ssh – or ftp; is there a way to do this an not break anything that you know of?


    • Yes, you will break everything if you change the name of the directory it is in. Luckily, there is a great Search & Replace plugin you can use:

      So, what you’ll want to do is to change the directory name in the General Settings in WordPress – BOTH settings. Then, change the actual directory name via FTP. Next login to WordPress as the new URL – eg

      Then, use the Search and Replace plugin to change:

      Then, follow the steps in my post to have the URLs of the site display from the public_html (main domain url) and the images of your site and your wp-admin will still display from the subdirectory since that’s where WP still lives.

      Let me know if that makes sense!

  161. If you have a good site, this method is useless. All your old posts will be dead links in Google. The author doesn’t mention this in the text above, and I had to spend my time undoing everything again.

    So, if you have a large amounts of readers from googling, you probably do not want to lose them by doing this. If you have a small site, yeah, go ahead.

    • Hi,

      You make a good point. Having all your posts show from the root, of course, does result in all your posts displaying form the root, hence the URLs do not display from the subdirectory any longer, which is the whole purpose of this process.

      If you do have an old site, then you don’t have to abandon this method to address that issue. You can simply do put a command in your .htaccess file to redirect all the old URLs en masse to the new root domain. I have put put this in the comments as well, but I’ll add it to the main post, so people do think ahead about how they will handle their old URLs. Also, the Redirection plugin can be used to redirect the old URLs to the new ones, but if you have a lot of them, then the .htaccess file will work better. You just don’t want to redirect your wp-admin login to the root, because you still do need to access that from the subdirectory.

  162. Thank you very much for this article.  Going live with my new WordPress based web site was  made easy by simply following the steps above (  And thanks for my host at for finding your article and passing it along to me.

    - Gerry Fraiberg

  163. Hi again, and sorry – I went ahead and renamed the index.html file so you can see what I am describing.

    Thank you again!

    • Hi Paul,

      You need to have the index.php file that had been in your subdirectory moved to the root directory. In your index.php file in the subdirectory, you now have perhaps the silence is golden index.php which is not the file you want in the root but is good in the subdirectory. If you need to, you can redownload wordpress from and grab the index.php file from there. It’s in with the other wp files in the main wordpress folder. Upload this index.php file to the root directory of your URL, where you used to have the index.html. Make the edit to this file per my instructions in this post.

      Next, you should not have done anything with your wp-config.php file.

      Finally, login to WordPress if you still can and check:

      In the General Settings it will look like:

      WordPress URL:
      Site URL:

      So, the site url should not have the subdirectory.

      Lastly, put all your OLD html files in a subdirectory to get those out of the way.

      Contact me directly via my contact form if you need more help. I think you’re close.

  164. Hi Angela,

    Thanks so much for your straight-forward resource! Unfortunately, I’m at a point where I’ve tried so many different resources to help me move wordpress from a subdirectory to the root directory that I fear I have messed things up pretty well. Now, nothing seems to work, and I am constantly restoring the subdirectory just to get back to a point where all the material is formatted and intact. Here is the link as it stands in the subdirectory. At some point, I had changed my wp-config.php file to try the overwrite suggested on the WP codex, but now the WordPress Address in my Settings is greyed out and uneditable. I tried downloading a fresh wp-config.php file and repopulate the information, but it turns the blog into a long list of links, followed by unformatted text and images. When I move the index.php file to the root directory and edit it, it also reverts to an index listing of links. I have restored the index.html file so their old site displays while I try to dig my way out of this hole. I also changed the subdirectory “wordpress” to something else as per your suggestion, but it removed all formatting and images, and I wasn’t sure how to adjust the permalinks to reflect the change properly. I look forward to any suggestions you may have for me, as I am about to pull out my last clump of hair. Thank you!

  165. Hi!

    Looks like you know this stuff =) i have not been able to find any answer when i google this question..

    i am have installed wp in a subdirectory and made all the changes needed so it looks like this

    WordPress address:
    Site address:

    And everything works, almost… when i press the “home” button i get directed to when i want to end up at

    i have tried different ways but i either ends up with error coeds or blank pages or missing pages…

    Do you have any idea what i can try?

    • Hi,

      Go to your custom menu (Appearance > Menus) and make sure your home page URL is set correctly. You probably had Home going to the subdirectory when you were setting things up initially, now you just need it to go to the root. If it’s not set in the custom menu, then your theme may be wanting to send it to the wrong URL, so you can edit that in the header.php file in the menu div. Anyway, it’s a simple fix. Let me know how it goes.

      • Hi and thanks!

        It solved my problem, but it was as an alternative solution.

        Because i had Enabled Home button through the Theme Settings…. so i still wonder. But thanks so much now i have a better working site!

        • Yes when it’s set through the theme settings and doesn’t work correctly (ie you click “show home link” in your theme options), the theme developer did not code the home link URL correctly. You can fix this in the header.php file of your theme. Likely they used the wrong bloginfo parameter for showing the home page link.

  166. I tried this, it did not work for me but i am running some extensive plugins including wp e-commerce and flexishops.  I found that writing an index.html redirect in my public html directory worked just as well.  

  167. Hello again! I followed your tutorial and Everything is working good. Thanks a lot.
    Only one thing – I dont get my wordpress admin BAR on top of the page when I am logged in. I have enabled it in my profile to show everywhere. It is good when to edit a page quickly.

    • I’m glad it worked. In terms of the admin bar, if you have both checkboxes checked to show it on the site and in the dashboard in your user profile, and it still does not show, then make sure your theme has the wp_footer(); php template tag in your footer.php. You’ll see this template tag in the TwentyEleven theme if you need to copy it to your theme’s footer.

  168. Hello again! I solved the issue by renaming the index.html file to so that apache looks for the index.php file first. I went ahead and installed the silence is golden plugin and it seems to be fine. FYI for anyone who has a similar issue! Thx!

    • Yes, you can’t have two index files in the same directory. I wrote to someone else about the same thing. They left their entire old site in the root directory and had matched all their URLs, so of course, the old html files were being pulled instead of the WordPress files. You do need to MOVE or DELETE or rename your old files. Keep in mind that Google WILL index these files, and you will be deprecated for duplicate content on your site, so you should delete your old site files (perhaps download them first so you have a backup) or move them into a folder called OLD and use a robots.txt file to prevent Google from searching that folder.

  169. Hi, WP Girl!

    I really have enjoyed your tutorial! It was very handy, because all other instructions directed the user to move all files where their blog was held to the root causing a huge clutter, so thank you! I had one issue that I have been trying to fix, I cannot find my .htaccess file. I am using FileZilla for Mac OS, so first, I checked the “force showing hidden files” option to enable me to be able to view all hidden files and no luck. Next, I tried creating a .htaccess file in TextEdit, pasting the .htaccess into the file, and saving it as 1.htaccess and renaming it simply .htaccess within FileZilla once I moved it to my root directory, but caused my whole site to go down. Also, I tried switching FTP clients to see if that was the issue. The only way that I am able to change my permalinks is if I include /index.php before the rest of my link, which has been alright, but it is causing issues for me now that I am installing other plugins, such as WP E-commerce, since the products and pages that it creates takes out the “/index.php” part of my permalink generating an error message whenever I click any of those links. Do you have any tips or suggestions on how I can change my permalinks or create an .htaccess file, so I do not have to include /index.php in my permalink? Thank you in advance for your help :)

    • It sounds like you are likely on Yahoo web hosting. Am I right? Yahoo is not a great WordPress web host. Yahoo does not allow you to create an .htaccess file, nor will it allow you to run BackupBuddy plugin or many other plugins. The server access is highly restricted. Yahoo will force you to do just what you did with the /index.php in your permalinks. My recommendation is to sign up with a host that specifically supports WordPress, such as Blue Host, Host Monster or Host Gator. If you are not on Yahoo, you are on another host that is equally as restrictive.

      • I am on Shoppepro, because originally, I liked their e-store design, but later, I decided to just go with a blog. Now, I see the downside of staying with them. Thank you so much for your help, I will switch and hopefully that solves my problem

        • I understand. You’ll need to backup your database and all your files and set up a new blank database at the new host and import your old database into it. There are instructions on on how to migrate a website. I usually use BackupBuddy to migrate sites, because it makes it a piece of cake, but I wasn’t able to get BackupBuddy to run on Yahoo hosting, and I’m afraid you’ll have similar issues on your host. You can use the wp-db-backup plugin to backup your database easily.

  170. Thanks for this great tutorial. It’s the best I’ve seen on the subject.

    Just so that I understand correctly, if I want to develop a new wordpress site to replace an existing .html site I could develop the site in a subdirectory and then move it over to the root when it’s ready. In this case, I just want to confirm what my settings should be while the new site is in development.Let’s say I install the new development site at and the existing .html site is located at

    During development of the new wordpress site my settings should be:Under Settings -> General tabWordpress Address (URL): Address (URL): then when the new site is finished, I would proceed with your directions. Am I correct?

    • Hi Joseph,

      Yes, you will install WordPress in a subdirectory of your current html site. If you use your web host’s auto installer, then the General Settings in WordPress will automatically show the URL to the subdirectory. If you do a manual install, then this will also be taken care of because the installer for WP will automatically use the subdirectory. In the General Settings it will look like:

      WordPress URL:
      Site URL:

      When you are done with development, you will follow my instructions. You will want to place all of your old HTML files in a folder called “OLD” perhaps or download them and delete them, so Google doesn’t index those anymore. You’ll want to install the Redirection plugin to create 301 redirects from your old HTML pages to the new URLs for those pages. You do not need to keep the old HTML pages for the redirection to work.

      Good luck!


    • Hi Nabeel,

      It probably speaks more to my having grown up with the super heroes of the 70s-90s: Mighty Mouse, The Boy Wonder, Bowler Girl (my personal favorite), Go Speed Racer, Tank Girl, etc. Anyway, yes the content is original. I found another post on bizaquarium that I used to send people to, but their site got hacked, and they were missing some important bits of information, so I was compelled to write a fresh one. Thanks for writing. I like your blog. I’ll follow you.

      Angela (aka WP Girl)

  171. Hi thr, got quick question. What if i wanted to point wp-admin directly to root without entring subfolder name ex –> is thr anywhr i can fix this via domain management? 

    • The only way to have the wp-admin not display from the subdirectory but still be in the subdirectory is to change your domain management to point your domain name to the subdirectory. In this case, you would NOT follow the instructions in this post and would instead ask your host to use the subdirectory as essentially the www or public_html folder of your site. Then, you would change your WordPress General Settings to the URL of the site (eg without the subdirectory AND you would need to install the Search and Replace plugin to replace ALL of your internal image links (eg do a search on “” and replace with “”). I’ve certainly known people to do this.

  172. This works beautifully.  But, here is the problem: existing links out there in cyberspace to your original articles don’t work.  For example, if you originally published a blog post or article (let’s say its filename is XXXX.html) and published it out and its permalink is:
    And now your blog is redirected to root, all NEW articles will get the correct permalink, like:

    But, what if someone sees the original backlink and clicks it or just types it into the address bar?  Bummer!

    So, here’s what worked for me: in the “blog” directory (or whatever you called it), comment out everything in the index.php file and then add this code:

    [I deleted the code because I don't want anyone using it. It is perhaps not as secure as it should be--AskWPGirl]

    So, this converts “” to “” and all existing backlinks work fine.

  173. Hello! Thanks for this great resource. Please can you tell us – what is best for SEO – wordpress in root or sub directory? I read somewhere that for SEO, it is better to install in root.

    • Hi Karan, technically, that is correct. However, having your WordPress APPLICATION installed in a subdirectory is NOT the same as having your website pages showing from the subdirectory. This is an important distinction. ONLY the application is in the subdirectory. By following the steps in this post, the actual URLs for all of your posts and pages are displaying from the root.

  174. Hi! I read your blog instructions and several others and sat down tonight to do the work of redirecting my subdirectory site files so they’d show up as root files but it didn’t work out well. In fact, I’ve lost my access to my WP interface. I am feeling a bit overwhelmed and lost at the moment. Can you give me some help for what to do now?

    • Hi Chris, You will still access the wp-admin via the subdirectory. I’m heading out right now, but I can help you in about 1.5 hours. Read through all the instructions carefully again, just to make sure you didn’t miss a step, particularly with the edit of the index.php file where you have to specify the subdirectory. See if you can log in to WP via your site URL/subdirectoryname/wp-admin.

    • Angela! Thank you thank you for your time. My site is working fine now. I so appreciate your helping me to learn more about this option. – Chris

      • Hi Chris. You’re welcome. I’m glad we could unravel your hosting issue and get things working again. Good luck!

        • Hi Angela, you’re up too! I’m working on another site, it’s a fresh install of WP into the root but needs to be put into subdirectory while it’s being built. I am trying to move it but I forgot to log on to the dashboard and add the subdirectory folder path before I moved the WP install into the subdirectory. Aargh! Now I can’t log on to the site admin/dashboard. What is the best way to manually edit/fix so I can log on?

          (BTW, Speed Racer was my first boyfriend. And what about Marine Boy!? You go girl!)

      • Wait! Forget that last request for help! I did it! Wow. It’s so nice to try something new (myPHPadmin stuff) and have it work! I think Racer X was helping me out. – Thanks Angela, Chris

  175. Hi, I have a question about 301 redirects. If the root directory has an existing HTML site, then those .html pages will have to be redirected via 301 redirects in the .htaccess file, correct? I have gotten this far, and almost everything works fine. The WP site works perfectly, and the old .html pages all redirect to the WP installation. 

    However, what about the old index.html file? I can’t redirect that with a 301 redirect. What if a visitor has an older link like, instead of just If I remove the old index.html, will the visitor get a 404 error? If so, how do I go about redirecting references to index.html, to the new index.php?

    • Hi Steve,

      When an existing site is in the root directory, I install WordPress in a subdirectory. When it’s time to go live with the new site, I follow the instructions in this post and delete ALL of the old website files including the old index.html directory. Now, everything displays from the root, which is nicer than it displaying from the subdirectory.

      Finally, I install the Redirection plugin ( and do 301 redirect on all of the old pages, including the old index.html to go to the main domain name url. The Redirection plugin is very helpful for all of this, as you can type the full URL to the old site URLs and type the new URL on the new WordPress install.

      Good luck!!!

  176. This has been the MOST helpful article on moving wordpress domains that I have seen and by far the easiest to follow – Thank you!

  177. Angela,

    Thank you for this excellent post. This should be part of the official Codex! Many of us have working web sites, with an index.php already and thus install WordPress in a sub directory for development. I was struggling on how to best do this, and NOT have the subdirectory name show up when users are browsing the new site. Great instructions.

    • Thanks for the comment, Paul. I’ll see if I can submit it to the Codex. There are instructions in the Codex for moving from a sub-directory to the root, but they are very complicated. I think they actually have you moving the entire WP install to the root, which breaks all the image links. One thing that’s important, I need to add, is to create a blank index.php file in the subdirectory (a Silence is Golden index.php that you can find in the themes folder), to avoid allowing users to see an index of your WP install. You can use the Silence is Golden plugin for this, and it also has some other nice security features.

  178. Hi, are there any SEO dis-advantges to not moving to root? I’m told goole penalise if the underlying destination is deeper in the website…

    • The underlying destination is NOT deeper than the root. The only thing that is deeper than the root is the actual WordPress application, which is just a technical thing and not a search engine related thing. All the URLs are from the root when you use this method of installing in the subdirectory but then following the steps I’ve outlined to display all the pages from the root.

  179. Will this work if I have WP Simple Shopping Cart Plugin installed? I know sometimes you can get a PHP Sessions error when the two urls don’t match….just wanted to check before I jumped into this switch.

    • Hi Danni,

      I haven’t ever really had issues with plugins with this method, because the WordPress directory is still the subdirectory, so no images, or anything like that get messed up, which would happen if you actually MOVED the entire WP installation. WP Simple Shopping Cart Plugin is a very simple plugin, so I sort of doubt it would have issues, and if it does, it will probably be a simple fix to be sure to specify the sub-directory in the code.

      Since this method doesn’t cause any major changes to anything, what I would do if I were you is to just do it during a low-traffic time, and test. If it works, great. If it doesn’t, you can just reverse the steps.

      Let me know how it goes!

  180. Thank you so much! This is working perfectly, I just have one question.
    I have noticed that since making the switch, when I click on “subscribe to rss” from my site, the link is broken….where do I go to fix this? Is it simply a matter of editing the url within the right file? Any advice would be greatly appreciated…I’m still a newbie, so I apologize if this is a really dumb question!

  181. Pingback: Moving Wordpress from one folder to another | Tech Information

  182. Hi Angela:
    I really appreciate your work on this tutorial, and it looks like it works for everyone but dumb ‘ol me. I really could use some help. I (thought) I followed your directions closely, but now I have two issues. Here’s what I did:

    Originally, I had my files in a directory named /wp . I moved the index.php file to the public_html directory; changed the “require line” to require(‘./wp/wp-blog-header.php’);
    and thought I moved the  htaccess file from the /wp folder to the root folder. I am seeing the page now at but it is now “unstyled” (obviously not linked to the stylesheet). When I click on the links, it is coming back with an “internal server error”, and the testing site is showing just the file structure.

    I also am unable to log into my wp-admin. I know this must be caused by something stupid I did, quite possibly mixing up the htaccess files, but I would reallllly appreciate your help, lest I completely rebuild the darn thing. Below is a copy of my two htaccess file codes. TIA for any help.

    Here is the original htaccess file from the root of the site when it was pointing toward the /wp directory

    # Use PHP5 Single php.ini as default
    AddHandler application/x-httpd-php5s .php

    Not sure what this one is:

    # BEGIN WordPress

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

    # END WordPress

    • Hi Murray,

      No worries. It’s easy to miss a little thing when doing this for the first time. So, what you also needed to do which you didn’t mention is to be sure the General Settings know the WordPress location! If you can’t login to WordPress, that’s a sign that perhaps you may have gone a bit to far with the General Settings and will need to login into phpMyAdmin to fix the settings in the options table. Also, you go ahead and delete the #BEGIN to #END in the .htaccess and see if that solves any problem with logging in. Feel free to email me directly via my contact form at The .htaccess should NOT contain the RewriteBase of /wp/ nor have ./wp in the RewriteRule. Here’s what it should look like:

      # BEGIN WordPress

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

      # END WordPress

      • Angela:
        Thank you for such a quick response! I will contact you directly, as it looks like I am getting off topic here! Thanks again! Murray

      • Hi Angela:

        We are all blessed to have you helping us with this. Thank you so much for your wonderful, rapid and extensive expertise. Thanks again!

  183. For those of you following this thread about moving your WordPress install from a subdirectory to the root directory, I do need to mention that you should put a blank index.php file in your WordPress directory after you move the one that was in there. This will prevent people from viewing the contents of this directory. The Silence is Golden plugin is helpful for doing this automatically. Or you can copy the index.php file that you’ll find loose in the plugins or themes folder that says “Silence is Godlen” in it. Very important!!!

  184. I have followed all of the instructions and everything is working perfectly except for images in my pages. My portfolio is showing images however. I can’t figure out why. When I look at the html, my images are not relative, they are absolute. Any ideas?

    • Hi Danielle,

      The beauty of installing in subdirectory and then moving that one index.php file to the root is that it results in links to images NOT breaking. If on the other hand, you actually MOVE the entire WordPress installation from the subdirectory to the root, then , all of the images links will break. I’ve never had image links break with the method outlined in this past, though. Only when moving the entire WP directory.

      The path to the images should be:

      If instead, it shows as:

      then something is wrong perhaps with your MEDIA settings, and the URL to the media is wrong there. Go to Settings > Media and check the path to the media. I usually leave this BLANK and allow WordPress to use the default media location which is what you should do unless you have your uploads in some totally different location in relation to your WP install. Some people feel compelled to put a path in the Media Settings even though they don’t need to, and I’ve seen this screw things up.

      If that’s the case, go ahead and set the Media settings correctly to the default location or leave it blank. Then, you can install the Search and Replace plugin and do a find and replace for img src=”http://… the path it’s using now and replace it with the correct path to your images.

      Let me know how it goes!

      • I seem to have done everything correctly. i left everything in my wp folder except moving the index.php to the root. The media settings are the blank, default ones, so my images are in wp-content/uploads/2011/7/image.jpg. You can view the site at and see on the homepage the 3 images that are missing, and on the about page where there should be a slideshow, but no images show up. I even tried to move the images to the root folder and reupload the images, but still no luck. I don’t understand why those links aren’t working, but all my portfolio images are fine.

        • Hi Danielle,

          Withthe slideshow, it appears the problem is with this theme’s settings in it’s code when you do slideshows. I did actually have that happen once with a theme. It has it hardcoded to look for the images in the wp-content/uploads folder and doesn’t know how to function when WP is installed in a subdirectory and then redirected to the root. It just still looks for the uploads folder in the wp-content folder rather than subfolder/wp-content.

          If you view the source code, you’ll see that timthumb script is not referencing your theme directly correctly on the home page where those three missing images are.

          So, you have done everything correctly, it’s your theme that is written incorrectly and can’t find the correct wp path. You can hack into the theme’s files and set the path correctly. I did do that once with a theme that was doing something similar. Anytime the timthumb script was being used to display in image, it couldn’t find it because it wasn’t looking for the theme in the subfolder/themes folder. It’s a pretty easy fix, but I don’t know where to tell you to fix it without seeing all the themes files. You can do a search in your theme files for “timthumb” and you might be able to see the place on the home page template and the slideshow template where it references the theme location. Or it might be in one of the theme’s functions files or other theme files.

  185. Unable to locate WordPress Content directory (wp-content)
    How do I change my ftp directory and is this fix right

    The fix was to change my FTP Root directory to one that includes the wordpress installation folder.
     I am using cloudflare and tried to up load a plugin and I get this message unable locate directory

    • Hi Billy,

      I have no idea what you are trying to do and why you are using cloudflare. This post has nothing to do with cloudflare and cloudflare has nothing to do with this post. This post is for those people who have installed their WordPress in a subdirectory and now want to have their posts and pages display from the root not the subdirectory. This does not involve dealing with the wp-content directory at all.

      If you are having trouble uploading plugins, you may not have installed WordPress correctly. Plugins do get installed in the wp-content directory. If you have a lousy web host who does not support WordPress properly, you will have issues with installing plugins and themes. I would recommend finding a good web host, such as Dreamhost, Host Gator, HostMonster, or BlueHost.

  186. I just did this for my first time ever on a test site…before I move a MASSIVE file that I’m working on. I’m quite new to this and Angela’s step-by-step instruction was so clear! It took me about 10 minutes to do it (so I’d still do the switchover at night). When it comes time to do the real thing, I’ll already have all my apps running that I need (I hadn’t logged into my FTP or launched my text editor)…I think I could do it in 5 minutes. Thanks, Angela!

    • Hi Erica,

      I’m so glad this worked for you. The beauty of it is that you only have to move one file instead of moving the entire WordPress installation, which causes all kinds of problems with broken links to images, etc. I really like working with the FTP application called “Transmit.” It’s super simple to use and lets you “move” a file to the “parent” directory easily. The trick that I haven’t put in the main instructions yet, is that you really need to put a blank index.php in the root directory after you move the WP index.php out of it. This prevents people from browsing your WordPress directory.

      To do this, simply copy the index.php file from the wp-content folder, plugins folder, or themes folder. If you open this index.php file in a text editor, you’ll see the words “Silence is Golden.” Make a copy of this and put it in the WordPress directory after you’ve moved the WP index.php out of there.

  187. Hi Angela!

    As a newbie to both web design & word press, I really appreciate the people that take the time to update these kinds of sites!! Right now, I’m struggling with the ‘move’ direction in number three. My URL is hosted by a company that uses parralell plesk, and I have no idea where to find any directories or roots- unless the folders you’re talking about are somewhere within the phpMyAdmin page and I just can’t see them. Do you have any suggestions for next steps??

    • Hi Celine,

      You need to get FTP access to your web hosting account. This will not be done in the control panel or the phpMyAdmin page. What this refers to are the WordPress files installed on your hosting account which you can see via an FTP application in the public_html (or www) directory or via the File Manager in your web hosting control panel. The index.php file being referred to is the index.php file of your WordPress installation. There will be many other files in the subdirectory you installed WordPress in, including wp-config.php. You will want to move this file using your FTP program to the root public_html folder (one level above the subdirectory where you installed WordPress).

      If you are not familiar with FTP, you may want to hire someone who is to make these changes for you because you’ll also need to modify that file as well. This is not something I would expect a novice html user or someone who doesn’t know what FTP is to do.

  188. Hi Angela,
    Sorry if I’m arriving late for the party! I triple read your instructions, yet I’m still having issues. The WP site I’m working on lives in a directory /wordpress but I want it to appear as if it lives in the root directory. Under Settings>General the WP URL reflects the sub directory and the Site URL reflects the root directory, yet it will not access the sub directory for any of the interior pages. I cleared out both .htaccess files, in the root directory and the WP directory, but to no avail. If I set the Site URL for the sub directory, all of the interior pages can be accessed, but obviously it also reflects the sub-directory, which I don’t want. Permalinks are set as: /wordpress/%postname%. Any help is greatly appreciated. Thanks!

    • Hi Steve,

      1 – Be sure you MOVED not copied the Index.php file out of the WordPress directory to the root directory and then made the modification to the require line per the instructions I wrote.

      2 – Your Permalinks settings should be just /%postname%/ do NOT put the word “wordpress” in there.

      3 – Clear your .htaccess file once more and go to permalinks > Save Changes. This will rewrite the .htaccess file contents. Check the .htaccess to make sure that it indeed did rewrite. You’ll need to refresh your FTP to be sure you’re viewing the latest .htaccess.

      4 – If you’re on GoDaddy, the rewrite may take up to one hour to take effect.

      5 – On some hosts, the .htaccess needs to be in the root directory rather than the subdirectory.

      These directions work like a snap every time, so the problems are likely related to one of the above not being done properly. If you want me to check things for you, please write me via my Contact page, and I’ll take a look at your settings.

      • Just a note to anyone reading this post: Steve’s issue was two-fold:

        1 – He was using a plugin to set his WordPress URLs to have .html at the end, so he could preserve his EXACT same URLs as his old site. However, he had not removed the old site files from the root directory, so the browser was opening those old files when anyone clicked on a nav link in the new WP site. To solve this problem, Steve removed his old site files.

        2 – Steve’s peramlinks were set to be /wordpress/%postname%/ (wordpress was the name of his subdirectory). This caused WordPress to sort of go into a weird loop because it was looking for the pages in the wordpress directory but the general settings wanting to find them in the root, resulting in a page not found. To fix this problem, we simply changed the permalink structure to /%postname%/ and manually inserted the correct peramlinks rewrite code (copied from into the .htaccess file because the .htaccess file was not being generated correctly.

        So the main issue was #2, when we got that fixed, then it was obvious that #1 was a problem and deleted those old files made everything work.

  189. Angela, Wow what a post, and thanks so much. How would i go about keeping my blog URLs as they are in the subdirectory, to maintain all Pagerank and rankings, but have the pages i create as root files / folders?

    • Robert – that’s an interesting question. I don’t know what your page rank is like now, but if you do 301 redirects (using the Redirection plugin) on those high ranking blog posts and submit to Google Webmaster Tools that your site address has changed from the to you might be able to recover from the change and not lose your ranking.

  190. Thanks for the excellent post! I used this approach on a client site and it worked perfectly. However, I’m now trying it on a different site and most of the links (strangely, only child pages and posts) give 404 errors.

    I first tried leaving the htaccess file in the subdirectory, which didn’t work. Then I moved it to the public folder, updated permalinks and it worked for a second. Then I edited a WP Page and the links stopped working again. I’ve tried moving htaccess back and forth between the subdirectory and public to no avail.

    Not sure what is causing this. Has anyone experienced this problem? Thanks.

    • Hi Tracy,

      If you are on GoDaddy, then you have to wait about an hour for the permalinks to work properly, because they only update their modwrite directives once an hour.

      You are on the right track with the .htaccess. One thing you should do is delete the contents of the .htaccess, so WP is forced to rewrite the modrewrite rule. Where the .htaccess file is located depends on your host. You can certainly put a blank .htaccess file in both the subdirectory and the root, then go to the Settings > Permalinks and click save, then see which file WP updated. You’ll have to refresh your ftp folder view to be able to see the modified file. Editing a WP Page should NOT cause the permalinks to suddenly stop working again, so that was likely a coincidence.

      Who is your web host?

    • Remember that your permalinks will change! So, you’ll want to do some redirects if you have important blog posts that you don’t want to go to 404 Not Found pages.

  191. I did as the instructions requested and all my images and pages work, but where the template adds a “home” button, it relocates to the subdirectory url instead of the root. What do I do?

    • Try clearing your browser cache. The Home page button via the template really should honor the General Settings just as all the pages and images do unless you manually changed it or set the button via a Custom Menu in which case you can re-add the Home link in the Custom Menu (or theme options) to get the correct link. Let me know if clearing your browser cache doesn’t work. What is your site URL?

  192. Hi, Thanks for the concise explanation. Got one question tho, my site was set on /blog folder and it’s been there for years now. I have used a 301 redirect to direct all traffic to the mysite/blog address. Now, over they years i have attained a PR4 and most internal pages also PR3 including some posts. The question is this, If i go through the move and remove the redirect, do you think i will loose all the internal PR, i know Main PR will remain the same as this is on the domain.

    • Hi, That’s a very good question. You would actually have to do a redirect on those /blog addresses to the new / address. I don’t know how this will effect your page rank. Hopefully, the new 301 redirects will take care of any possible 404 errors, and within a few weeks, Google will reindex those pages (be sure to install an XML sitemap). However, I really can’t guarantee what might happen for sure, but doing new 301 redirects and submitting a new XML sitemap will help.

      • Thanks for the swift reply. You hit it on the head, i was thinking of doing just as mentioned above but just not sure about the PR too. I know a lot of people say it’s not all about PR but if you had worked as hard as I did to get your Homepage and many page to a PR4 I’m sure you won’t just wanna loose it lool.
        Will try it out and let you know how it turns out.
        Tops WPGirl.

  193. Thank you so much for posting this! I looked everywhere for instructions on this, but all I could find was accomplishing the opposite. This was exactly what I needed — clear, easy to follow, and super quick! Thanks again!

  194. Hi Angela – thanks for the great post. I’m currently helping a friend with a wordpress installation; it’s a bit like the blind leading the blind. She a had a previous install in root, and I’ve put a new install in a subdirectory. The new install is a multi-site, or network install. After she has finished building the new site I will want the root directory to point to the new install/site. Is this possible in a network configuration? The network config uses subdirectories, not subdomains.

    • Hi Adam,

      I just looked up your question on the forums, and here is what I found:

      “Giving WordPress Its Own Directory will not work in WordPress 3.0 with multisite enabled. It interferes with the member blog lookup.”

      So, you will not be able to put WordPress in its own directory. You will need to install it in the root directory of the domain you want to use. I don’t know how this might effect your development process. There is an Under Construction plugin you can install to redirect non-logged in visitors to an Under Construction page while you finish your development.


  195. Pingback: Finding a Web Host for WordPress | Free WordPress Website Help | Ask WP Girl | Boulder, Colorado

    • You don’t ever have to use the Search and Replace plugin if you are following the instructions in this post, because all of the URLs will be correct using this method. If, on the other hand, you actually MOVE the ENTIRE WordPress installation from the subdirectory to the root directory, then you definitely will need the Search and Replace plugin because all of your image links will break.

  196. Sorry, I should say…

    to reinstall your theme after you take these steps…
    (not in this parti order)

    - move index.php and .htaccess to root (not WP subdirectory)
    - change header redirect in
    - change blog and site urls in WP settings
    - remove content from .htaccess
    - verify correct permissions of .htaccess [766 or 777] once new blank version is uploaded
    - resave permalinks to populate .htaccess
    - delete and reinstall your theme

    also before you do all this it might hurt a little but it makes sense to do this type of move with plugins disabled and WP default theme active.

    cheers to beers!

    • Thanks for the blow by blow of how you got your site to work. I’ll update this post as well. I have only had to move the .htaccess once, but I have found the need to delete its contents in order to get the permalinks to rewrite correctly. I’ve never had to delete and reinstall the theme. I would suggest that instead of having to delete and reinstall the theme, you might simply be able to activate the TwentyTen theme and then reactivate your own theme. If your theme caused problems, that would be highly unusual as the theme as nothing to do with the permalinks, but I have seen themes have problems and activating TwentyTen theme usually fixes these.

  197. I did the reverse. I installed the wordpress in the subdirectory and then moved the index.php as suggested. It seems to work find now. but I can not seem to get the permalink to get rid of the /press destination. Do you know if actually installing the program in root will eliminate the /press subdirectory?


    • Hi Andy,

      Actually, you did it just fine. What you need to do now is make sure you set your General Settings correctly per the instructions in step 2 above. Then, you may need to delete the WordPress contents of your .htaccess file and go to Settings > Permalinks and click Save Changes. This will force a rewrite of your permalinks. Let me know if that works. The whole purpose of my writing this post is to help people avoid having to move the whole WP installation to the root directory, because that has it’s own issues and is a pain in the a**.


  198. I’ve moved the wordpress installation to a sub directory named /press/… Now the url shows the /press after the .com. How do I get rid of the /press in the URL while maintaining the the installation at the sub-directory?

    Thanks for the great instructions.

    • Hi Andy,

      So, you actually moved your WordPress install from the root directory to a subdirectory? If you did that successfully, then you can follow the instructions in this post starting with step 1 in order to get the /press to not display. These instructions are for WordPress installs that are in a subdirectory but for which people want the URLs to display from the root.


  199. Thanks for the great tips – all worked well until I tried to login to my theme via the wordpress dashboard – I am using headway and now I have the Index of/superdynamo( my previous subdirectory name) showing up not opening up my visual editor – any ideas?

    • Hi Wanda,

      After you have the website displaying from the root directory, you will still need to log in via the subdirectory, because the actual WordPress application files are still in the subdirectory. I’m not sure what’s going on with your visual editor — are you referring to the visual editor buttons? Do you have the Visual tab selected when you go to edit a post? You could try enabling the default theme and then re-enabling your current theme to see if that solves the problem.


  200. That worked! I had tried going to Permalinks and clicking Save Changes before, and it didn’t work. I didn’t think to clear .htaccess and start from scratch. Thank you very much!

    • Hey, cool. I’ve found that I do sometimes need to clear the .htaccess to get it to rewrite. I’m not sure if it’s host dependent or what, but I should add that to my instructions above.

    • Hi Michael,

      Be sure all your pages are working fine first – click on your posts to be sure the permalinks with the new location are working fine. if not, you probably need to update your .htaccess file. This can be done be going to Permalinks and clicking Save Changes. If that doesn’t work you might want to open .htaccess in your FTP application and then delete the WordPress info there, and then go to Settings > Permalinks and Save Changes. This will rewrite the WordPress portion of the .htacess file. Let me know if that does the trick.

      • I have the same problem Michael did.  I successfully went live about a week ago by simply moving the index file to the root directory and changing the site URL under the general settings.  However, now I cannot preview drafts or view published pages from the admin window (it tells me I don’t have permission or, in the latter case, generates a error).  The difference between my situation and Michael’s is that I’ve never found the .htaccess file in my WP directory — maybe because I haven’t set up permalinks?  To solve the preview problem, do I need to somehow create this file?

        • Very interesting. I had that happen once. Here are some things to check:

          1 – Make sure you edited the index.php file per the instructions to tell WordPress the subdirectory name. Also, be sure you moved (not copied) the index.php from the root install of WordPress (not the theme index.php) to the root of your www or public_html directory.

          2 – Make sure the WordPress URL in the General Settings contains the full URL to the WordPress installation with the subdirectory name in it and NO forward slash following it (see above example in the instructions) and that the Site URL does not have the subdirectory

          3 – If you haven’t ever set the permalinks, ie you’re using the default URL structure (eg ?page=123), then you probably don’t have an .htaccess issue because the .htaccess only comes into play if you are not using the default permalinks. Be sure you are using Default in the permalinks area to eliminate this issue as a variable. Using default permalinks will not result in a preview problem.

          Please check 1 & 2 above per the instructions in this post and let me know what you discover. Please feel free to email me directly through my contact form at

          • Hi,
            I’m having this same exact issue – did this person resolve it? I had permalinks at first, but then I turned them off to eliminate confusion on my part, and as a result I cannot access the (preview) from the admin panel. When I type this is directly, it says error 403… Totally lost! Also, the Silence is Golden plugin has not been tested with the current version of WP – and there is no data on compatibility. Do you know if it works?
            What a great post and a great site – sorry to add to the volume of questions! Thank you!
            - Oh and my hosting provider is WestHost, and they use Cpanel in case that helps. Thank you!!!!

          • The issue with the permalinks with a few users on this thread is that they are with a web host who doesn’t support WordPress very well, such as Yahoo. In these cases, the web host does not allow them to create a .htaccess file, and their permalinks didn’t work unless they included index.php in the permalinks structure or didn’t use permalinks.

            When you follow the instructions in my post it’s important to note:

            1 – you must edit the index.php file to include the subdirectory (see step 4 above)

            2 – you will access the WordPress Dashboard at the same location you used to access it:

            3 – if your web host allows you to create .htaccess files, then you can manually modify or create a .htaccess. Some hosting situations require that it be at the root directory rather than in the subdirectory. See for more information on the code that goes in there.

            4 – when following these instructions, you will be able to view the pages on your site from the root directory rather than the subdirectory, so, yes should show a page not found message

            5 – your general settings need to be changed exactly as they are exampled in step 2. If you typed these wrong, then you do end up locking yourself out of your account and will need to login to your cpanel, go to phpmyadmin, login to your database (the username and pw can be found in your wp-config.php file), and go to the wp_options table. Browse this table — on the first page is the Site URL – this should be the URL with the subdirectory and NO forward slash at the end. The second page shows the Home URL – this should be the URL without the subdirectory but no forward slash at the end.

            6 – So, be sure to check index.php and the settings above. If you are still having issues, email me via my contact form at – most issues are either a little mistake or an issue with .htaccess at your web host.

            Regarding Silence is Golden, I am using with 3.2 fine. However, I tend to manually create a the index.php files because I try to avoid using too many plugins.

            If you want to reply here, then please let me know:

            1 – can you login into the dashboard via

            2 – can you see the site via

            3 – what happens when you click on page links from