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

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

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

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

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

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

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

Before attempting to move WordPress

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

Remember that your login and registration links will still be

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

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


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

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

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

<!--?php // Silence is golden. ?-->


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


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

Angela Bowman

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

View all posts by Angela Bowman

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

  1. Angela,
    I normally wouldn’t post here but your comments were so helpful. I want to thank you for this site. It was very useful. Pardon the following question as I am a NOOB. I followed your instructions and everything worked fine except that when I access my site remotely, I am using my phone not on the home wifi, the site shows up without the pictures and formatting. The text is there but it simply looks ugly. I am hosting the site myself and within the house when I connect to the computer in the house everything looks fine. I modified the php file as you said. I also ended up copying the .htaccess file too. I thought this would fix it but to no avail. The site is if you would care to have a look. I would appreciate any thoughts you might have. I am sure this is something simple, but I am very new to all this.

  2. Angela, thanks so much for your clarity (and your patience :)).
    I applied this procedure for many sites and it worked fine every time.
    But now i don’t Know if i can use same procedure in case when
    there is already a wordpress installation installed in the same way
    as you explained. I am going to lunch a new version of the actual site,
    I’ve installed this version in a subdirectory (/new), also the actual version of the site is in the subdirectory
    (/old). What’s the procedure to make display the new version of the site as
    it were in root folder instead of the actual site? Thanks.

    • Hi Mary Hellen,

      You can do this process even if there were a previous site installed the same way. Follow all the steps in this post, however, there will already be an index.php file in the public_html/root directory that you can simply edit as instructed in this post. Let me know if you get stuck.


    • It might be a plugin that is causing an issue. Sometimes caching and security plugins can be a problem. I would rename your plugins folder to plugins-old, then try to login to the site and visit the plugins page. It will show all the plugins de-activated. Then, rename the folder back to plugins, go back to the plugins page and take note of the plugins you have installed and activate them one at a time. If you are using Wordfence, let me know as that has special considerations and steps for “migrating” to new URL.

      If you have a caching plugin, you may need to delete old cached files. Let me know if you are using a caching plugin.

      Also, if your web host does caching, you’ll want to clear the cache there.

  3. Hi,

    I followed all your steps and everything worked perfectly!! Thank you SO MUCH! You really wrote everything perfectly and easy to understand. My site is live and it only took around 10 minutes to do so! 🙂 Thanks again!

    P.S. this was my first time making a site live, which shows you how well you explained everything! 🙂

  4. Hi Anglea, I have followed all your step closely and I get a HTTP ERROR 500, I have been through the FAQ page and still no luck. I must be missing something. I would appreciate any help you could give.

    • Hi Jayson,

      I would try to de-activate all your plugins by renaming your plugins folder to plugins-old and see if that gets rid of the 400 error. Then visit the plugins page in the Dashboard. You’ll see that all the plugins will be miss. Then rename the folder again and activate the plugins one at a time. Sometimes also switching to the default theme and then making the move and then re-activating the theme you want to use can help. Some plugins and themes are just not coded very well and can cause issues when moving, but then they will be okay after re-activating after the move.


  5. Hi,

    This will be my first time moving a site and making it live so I am not very familiar with some of the things you listed in your steps.

    1.) you said before I move my site, I have to use a caching plugin. Is this mandatory or can the site still work without caching it? Also, if I have to use it, do I just download a caching plugin like: into my site, cache it then go on with the rest of your steps to move my site? I’m just not familiar with the whole process of caching.

    2.) Like question 1, do I have to do the same for backing up my database (😉 ? if so, once I back it up, do I de-activate this plugin before I move on to the next steps?

    3.) Inside my FTP (FileZilla) when I go to download the Index.php file a box pops up saying “this file already exists, please choose an action, 1.) overwrite, 2.) overwrite if source newer 3.) overwrite if different size, 4.) overwrite if different size or source newer, 5.) resume 6.) rename 7.) skip”. Which action do I select? (also, I haven’t deleted my old site files yet, is that why this box is popping up? Plus whenever I get to download it, what folder does it get stored in so I can select it later?

    4.) In your step 2, you said after downloading the Index.php from the sub directory that I have to upload it to the root – www, htdocs, or httpdocs folder, are these folders the same as my “public_HTML” folder? I am using CPanel and my public_HTML folder is where the root domain is stored.

    • Hi Lea,

      I got your other message that it all went fine, and I’m a bit behind on my replies, but I wanted to reply so others would see the answers to your very good questions:

      1 – What I write in the post is to DE-ACTIVATE any caching plugins that you may be running. The point is to NOT have caching plugins active and to DELETE any cached files if there are any, as the cached files will pertain to the old URL and not the new one and will cause issues with any type of WordPress migration. Since you weren’t using a caching plugin, you don’t have to worry about this.

      2 – It’s always a good idea to back up the database before making any big changes to the site. You can de-activate this plugin before or after migrating or keep it active so you can setup ongoing backups. See my post on Backup Up WordPress:

      3 – That is interesting. I wonder if you had previously downloaded a copy of your index.php file to the location you are choosing on your computer?

      4 – Yes, the www, htdocs, httpdcos, and public_html folders are all the same. I need to edit that text! Thanks for pointing that out.

      I’m glad everything went smoothly.


  6. I followed the instructions and everything worked except the homepage, which was giving a “page not found” error and still trying to use the subdirectory url. I checked the theme’s header.php as well as the .htaccess files and couldn’t find any relevant code. I also used the broken link checker plugin and updated the permalinks, but also no help. (Also rechecked the require line in the index.php that I copied into the root directory.) Not sure what else to check. I’m hosted with if that’s of any use.

    • Hi Mitch,

      The home page link is set in Appearance > Menus. I think you’ll find it using a Custom Link with the old URL.


      • Hi Angela!

        Thanks so much for putting in the time to help everyone. I’m having the same problem as Mitch, and I tried your suggestion, but unfortunately to no avail. Specifically, for the home page link in Appearance > Menus, I tried using the root URL as well as the URL with the subdirectory.

        If you have any other ideas, I would really appreciate the help!

        Thanks again.

        • Some web hosts, like Network Solutions and, have a setting where they redirect the main URL of the site to a subdirectory when you install WordPress in a subdirectory. It creates such a challenging problem for people as locating this redirect in the control panel interface is like finding a needle in a haystack.

          If you are on one of these hosts, you need to go to your “My Installed Apps” are in the control panel and click “unset this wordpress my homepage” option. This will stop the home page from redirecting to the subdirectory.

          Let me know your URL and who your host is.

      • Update for others with this problem: I was able to get it fixed.

        I contacted my webhost, and in the control panel, he explained that I can turn the error log on/off. Sometimes, a change will be need to be made to the server configuration, and all that’s needed is to click “apply” to implement the changes. I don’t know the details, and I imagine it varies depending on the web host, but there may be a similar option on a lot of platforms. Apparently, it amounts to refreshing/rebuilding the vhost, but it only requires two clicks!

    • Hi Silver Darling, Thank you for saying so! I try! I wrote this originally for my students before their were instructions on I’m glad so many people have found it valuable.

  7. Hi Angela,

    Do you know if this step keeps the SEO as it was, or does something has to be done in maintain it?
    Furthermore, what setup would you recommend in order to have the best SEO?

    • Hi Terry,

      For this process, the URLs will change from having the subdirectory in the URL structure to not having it. Therefore, you would want to redirect the old URLs to the new ones to maintain the SEO rank of those posts/pages. The easiest way to do this is using the Quick Page/Post Redirect plugin:

      You will enter the old URL in one field and the new URL in the other field. You will do this for each post and page on the site.

      This creates what is called a “301 Redirect”. Here’s the definition from

      “301 Moved Permanently. A 301 redirect is a permanent redirect which passes between 90-99% of link juice (ranking power) to the redirected page. 301 refers to the HTTP status code for this type of redirect. In most instances, the 301 redirect is the best method for implementing redirects on a website.”

      I’m not sure why the 90-99% range is there. I’m assuming that the potential loss of 10% is related to people potentially doing 301 redirects to non-identical pages or other factors related to the content that effect the link juice passing down.

      Removing the subdirectory from the URL structure, I think, can only help, because it simplifies the URL which makes it more friendly overall and not cluttered with meaningless keywords (ie your subdirectory name).

      Good luck!


      • Thank you Angela for your perspective.
        I have just attempted to perform this simple solution but unfortunately, it didn’t work for me. My homepage shows correctly, but my inner pages do not load. I have moved my htaccess file and used the content wordpress generated for me, but to no avail.
        I think I will try a physical move, as there’s not really anything else on the root folder.

        • I’m glad moving the site worked for you. Usually when this process doesn’t work, it’s due to a typographical error made during the process.

  8. Hello,
    I cant find the: WordPress Address URL, and Site Address URL under Settings—General. Is it because of my version of WordPress (version 4.7) which is the latest version? Pls where did they hide those options?

    • Hi Martin,

      If you are using WordPress multi-site, these settings will not be available under Settings > General.

      Do you know about how the site was set up? Do you have Administrator privileges?

      If someone hardcoded these settings into the wp-config.php file, you will not see them in Settings > General.

      To check the wp-config.php file, you will need to login with FTP or SFTP or the web host’s Control Panel and edit the wp-config.php file and look for these lines:


      Let me know what you find!


      • Hi Angela,
        I need to do exactly what this article is doing, but for a multisite installation that is currently installed with PATH_CURRENT_SITE,’/main/’ and I want it to be just ‘/’. Any ideas? (I have a redirect in root now)

        • Hi Pol,

          In this case, you need to move the install to the root directory. This is slightly more tricky with multi-site than a regular site but the concept is the same. See my instructions here for MOVING WordPress to the root directory:

          I would make a backup of the full install before proceeding.

          Before doing this on the live site, I would use another domain that you don’t use right now, maybe something you purchased and never got around to using, and set up the exact situation as you have now with some dummy content and dummy multisite installs, then try the process in the link above and see if it works! Here are a few more tips on moving a multi-site install:

          Let me know how it goes!


  9. Great article Angela!

    I will use it this week for my new site, I have 2 questions.
    1) I am running Wordfence premium security; I was wondering if I have to turn this off while doing this?
    2) I am a little worried about the following “Also, if you have a lot of internal hyperlinks, you will need to manually update those.”. Can you explain to me which links will work and which links will need to be changed manually after this? I assume it are all the text links in the pages? I am using Divi, not sure if this makes a difference. And what about all the buttons and links in images I have? I have many pages…


    • Hi Gijssio

      I would definitely turn off caching and your security plugin before doing this process. Clear the cache and then de-activate. You will need to reset your cache settings after the process as all the URLs will have changed for the pages/posts.

      As for Divi and internal links, I would do a search on the Posts list page (Posts > All Posts) and the Pages list page (Pages > All Page) for the old URL to the site, then edit any buttons manually to the old URLs. I hope there are not too many. It’s hard to do a global search and replace because upload images and files will still reference the URL with the subdirectory name in it.

      If you would like to actually MOVE WordPress to the root directory, I did write instructions for that process here:

      This process is a bit more involved.

      Good luck! Let me know how it goes.


  10. Dear Angela, marry x-mas and thank you for being such a great help to so many people. I wonder if I would be allowed to bother you with my question. I installed wordpress as n00b and ended up having my multi-site like this:,, May I ask if you know of anyway to mask the /wp/ part of it?

    In this article you commented somewhere that the presented way cannot be used for multi site, hence my question.

    Thank you so much!

    • That is going to be impossible as the install files are in the wp folder, so any attempt to rewrite the URLs will also make the WP files not work.

      In this case, you need to move the install to the root directory. This is slightly more tricky with multi-site than a regular site but the concept is the same. See my instructions here for MOVING WordPress to the root directory:

      I would make a backup of the full install before proceeding.

      Before doing this on the live site, I would use another domain that you don’t use right now, maybe something you purchased and never got around to using, and set up the exact situation as you have now with some dummy content and dummy multisite installs, then try the process in the link above and see if it works! Here are a few more tips on moving a multi-site install:

      Please keep in touch, Matti, and let me know how this goes!


  11. Hi to all,

    You can leave the site exactly where it is and just tell WordPress what you’ve done by making a few changes to settings and minor edits to a couple of files. It just takes five minutes or less.


    • Hi Chris, Yes! And that IS exactly the process I describe in this post! It is easy, and it takes 5 minutes. Sometimes people skip a step or make a typo, so these instructions and the FAQ help people check their work and make sure they did the simple process correctly. Most people do. Did you have a chance to read the post to see that this is the process I am describing? Maybe you commented based on the title of the post and didn’t realize I had written what you described. ~ Angela

  12. Thank you very much for your post. Very informative, and it worked like a charm. However, I’m having admin-ajax.php issues. We moved our site from to, and we are receiving the following error message on the page (none of the lightboxes are working):

    I tried to create a robots.txt file with the following:

    User-Agent: *
    Allow: /wp-admin/admin-ajax.php

    and placed it in my root directory, to no avail. Any thoughts?

    Thank you.

  13. Thanks for the tips, Angela! I’ve followed your procedures above and all seems to be working fine. One thing that I’ve noticed is that Google searches of keywords where I know our site will show up, show the actual path of the page (, versus the “alias” path ( Any idea how to prevent Google from showing this?

    • It sounds like Google had indexed the old pages of the site which will now show as 404 errors. In this case, you will want to use the Quick Page/Post Redirect plugin to enter redirects for the old page to point to the new pages:

      In a few weeks, Google should then be indexing the new pages. You’ll want to do the redirects, though, because you don’t want to use your Google page rank on these old URLs. By doing the redirect, you are transferring the keyword value of the old URL to the new URL.

  14. Thanks for this… I had done all the steps except removing my old index.html file from root, from a previous incarnation of the site — moving that file out was key, so thanks for the tip!

  15. Great advice here, thank you for taking the time to share!

    On a loosely related topic, what method would you recommend for maintaining a mirrored “dev” version of a site for testing purposes? I’ve got a decent amount of experience doing this with HTML5 sites, but I’m relatively new to WP and the trouble I’m having is with licensing/activation of paid plugins & themes on the “test” site versions.

    I have to imagine this is a relatively common practice; if you have any advice on how to maintain a mirror site effectively, I’d greatly appreciate it!

    Thanks in advance!


    • Hi Kirk,

      I think that would be a great topic for a blog post. There area a few approaches:

      1 – Have a local copy of a site on your computer using MAMP, XAMP, or my favorite DesktopServer. DesktopServer works on both Mac and PC and allows you to create development environments with the click of a button. After you create the site, you can then “deploy” it to the web host. Once it’s one the hosting account, you can do one of three things:

      a) Use the local copy for testing updates, coding changes, etc. If it’s all okay on the dev site, then “publish” or “push” the changes to your live site. Using a coding application like Sublime, Coda, or Brackets allows you to sync via FTP to your production (aka live) site with the push of a button. So you test locally, then publish using your integrated development environment application (e.g. Brackets, etc).

      (When I say “push,” I am referring to using Git repository to do version tracking on your changes. It’s great for more complex sites and working in team environments, but it has a big learning curve. You can learn more about that here:

      In this first option, you would not necessary keep the database synced, which is typically NOT super critical when testing most updates and changes. The content on the production site will differ from what you have on your local staging site, but all the core, theme, and plugin files will be the same.

      b) Use the local copy as indicated above but keep it in sync with the database. This is a bit more complex and challenging to set up, and you have to consider how to get production site changes that effect the database back to your local site, so you don’t overwrite live site changes with your local copy. Honestly, even though I use Git workflow on some sites, we do not sync the database content. It just hasn’t been necessary. However, if you are interested in this process, Sridhar Katakam wrote an in-depth tutorial on it here:

      c) Use a web host such as Site Ground, WP Engine, or Get Flywheel who provides staging environments as part of their services. You can quickly copy the live site to staging, test changes, and either push the staging back to live or just repeat the changes you’ve tested on staging on the live site. They often offer the options of just pushing the file changes and not the database changes which is handy if the production site is very active with publishing, commenting, e-commerce, etc.

      I hope this helps point you in a direction. I can’t recommend DesktopServer highly enough. It’s very liberating and saves tons of time. Even if I don’t keep a perpetual local copy of client’s sites, I can easily duplicate their site using the Duplicator plugin and import it into DesktopServer to test certain plugin and theme updates I think might need carefully checking before repeating the process live. On my larger client sites, I am using Git and a perpetual QA environment, so I go from local to QA to production. Much more time consuming but less likely to break anything on production.

  16. It’s really a nice and helpful piece of info. I am glad that you just shared this useful information with us.
    Please keep us informed like this. Thanks for sharing.

  17. Hi – Everything went fine – except now when I click on the site logo (which usually brings you to the home page) I get a Page not found 404 Error., Can you please tell me how to correct this issue?

    • Hi Will,

      If the logo link isn’t working, it might be in your Theme Options. Check there where you set the logo up as I imagine that is a field you will have to manually change.


  18. Great article, Angela. But let’s say I set up a WordPress site under a subdirectory for a client, they’re happy with it, and now they want me to move the website onto THEIR webspace. How would I go about doing that?

    • Hi JerY,

      Great question, and the answer is: Use the Duplicator plugin! It works awesome. I’ll write a post on this. Essentially, this is called a “site migration.” The Duplicator plugin will zip up the entire site. You will download the Zip file and the import script it provides and upload to the client’s public_html directory (copy their old site into a folder for safekeeping — if all works well, download and then delete their old site).

      On their web host, you’ll use the MySQL Wizard to create a new, blank database.

      From the web browser, you’ll visit their domain /import.php – This will launch the Duplicator script you uploaded, unstuff the archive, populate the database, rewrite the URLs to their domain, and you are done!

      They have a great video tutorial at:

  19. Hi Angela,

    I am running into a bit of trouble, it would be amazing if you could help/guide me to fix this issue.

    So, initially there was a wordpress site already installed in the main folder called WP. so the structure goes like” /WP”, where “/” is the root.
    So then, I created a subdomain called which lives in the directory “/dev”.
    So meaning there are two folders in the root folder: “dev” and “WP”

    So I have completed developing the new site on the dev subdomain and now I want to make the main domain (ie. point to the /dev folder instead and run off that new wordpress site.

    I have followed your steps and did the following:
    1. Logged in to my subdomain’s wordpress backend and went to Settings -> General, and changed the WordPress Address (URL) from to and changed the site Site Address (URL) from to Then I clicked “Save” and then I could no longer access, as it automatically redirects to now.
    2. I logged in via FTP and downloaded the index.php file from the WP folder and then made a copy of that and then edited it and changed “require( dirname( __FILE__ ) . ‘/wp-blog-header.php’ );” to “require( dirname( __FILE__ ) . ‘/dev/wp-blog-header.php’ );”
    3. Then I placed the index.php file in the ROOT directory so its in the location: “/index.php”, so this ROOT directory is the parent of both “/dev” and “/WP”.
    4. When I go to, it still points to the old site and does not point to the new site in the “/dev” directory. I can now no longer access the anymore as it redirects to the main url and I am freaking out!!

    Please help!!

    Thank you very very much,


    • Hi Cullan,

      Yes, this is a bit of a mess and not a recommended process.

      Here’s what you can do to fix it:

      1 – Move all the files out of the dev folder and into the public_html folder (remove any non-WordPress files from old sites).

      2 – Login to phpMyAdmin in your web hosting control panel and edit the site and home URLs in the wp_options table to be

      3 – Login to the site and run the Velvet Blue Update URLs plugin to change all the URLs on the site from:

      Be mindful of the slashes and be consistent.

      That should fix everything.


  20. Hello and thanks a lot for your help, this article was godsent!! One quick info since I ran into the problem, my permalinks were the type that include the name of the article and that added an extra step, when updating the permalinks I actually had to change the permalink settings to “simple” save them, and then change them back to “name of the article” for the website to be running.
    Hope this helps if anyone needs it!
    Thanks again and take care

    • Hi Helix,

      If you have a web.config file that means that you are on Windows hosting, so that replaces .htaccess to allow pretty permalinks to be used.

      What you will want is to not have the subdirectory name in the web.config file. Ideally, it should be in the same folder as the index.php file, i.e. the public_html folder or equivalent.

      Try that and let me know what happens.


  21. A thousand, thousand thanks for the (mostly) simple explanation of how to run a site from a sub-directory. Even I – thick as two short planks – managed to do it. Eventually.
    I wonder if a word of warning might be in order. I’ve got a huge number of internal links on my site. The normal menu worked as expected, but all the page-to-page things had (have – it’s taking ages) to be re-done.
    Thank you, thank you, thank you.
    And now for a glass of something red.

    • Thanks, Ian. I had that on the post at one point. I just added it back in. Great feedback. Glad it was successful for you. If you had any page rank in Google for the old URLs, you will want to create 301 redirects for those so they don’t display as 404 not found in the Google Search results and the page rank will be transferred to the new URLs. I like the Quick Page/Post Redirect plugin for this:

      Avoid wildcard redirects as that will mess with your images and other uploaded media and WP core URLs.

      Good luck! Angela

  22. Hi Angela

    Thanks for a wonderful tutorial – that really helped me.
    Everything works now except from the main redirect – maybe you have a moment to help me:)
    I have now moved my site to, and everything works perfect after changing som links.
    Futhermore I have made som 301 redirects in my .htaccess file in the root. This is because I have many links from other sides around the internet linking to my site. I managed to get every pag to work except from the main site.

    So if someone write – they get redirected to
    but if they write they are not redirected – because of the index.php file “silence is gold”:)

    If I set a redirect in that one, everything works, but I cannot enter my admin… jiha:)

    Any suggestions?

    All the best
    Morten Hilmer

    • I think if you are careful with your redirect and don’t do any sort of wildcard redirection on it, it should work. I do that quite often, actually, when using this technique. Redirects can be so complicated, so you want to do a simple 301 redirect for this, e.g.:

      Redirect 301 /da

      You might want to test with 302, so it doesn’t get cached by the browser if it doesn’t work. Let me know if that works okay for you.

  23. Good Day!

    Pretty new to WP, just want to ask also since I have a fantastic site installed in the root directory which is working perfectly now. My problem is, I purchased a new domain and I installed WP in the subdirectory because I dont want to mess up my currrent site, Now that I have finished the development of the website which was installed in the subdirectory, I want the URL to be:
    How can I have both site working? I saw in your instruction that index.php need to be move to the root directory but the problem is there was an existing index.php that belongs to my original site. Do I need to overwrite it.
    Please advise. Thanks!

    • Hi Rick,

      If your original site is going away, then you can overwrite the index.php file that is there. If you are going to keep the original site, then you can’t have both sites using the root directory. There are creative ways to handle this. Let me know what your plans are.


  24. Hi Angela,

    You may have already answered my question but wow lots of comments here.

    Ive moved a site to a sub directory, no problem kinda.

    When I go to the admin login, it redirects to include the sub folder, the issue is when I login I get access to admin okay but when I view a page the edit bar at the top of the site dissapears so no quick editing of a page?

    Would this be a .htaccess issue, do you have an example of what the .htaccess file should look like?


    • Hi Bjarni,

      Glad via email we got this figured out and narrowed it down to your browser cookies needing to be deleted.

      Have a great day.


        • Hi Matthew,

          I was out of town and got a bit behind on replies. Have you tried logging in with a different browser? Let me know if you still need help. Feel free to use my contact page to email me directly.


  25. Just THANK YOU!:) After full day of googling and browsing useless hyper technical forums this was the first HELPFULL article.

  26. I’m working on a site that is hosted with Yahoo Small Business (blah). I tried following your instructions, but I am running into two issues…

    1) There is no public_html, www, htdocs, or root directory folder of any kind. The current site files are in “/”. Should I create a public_html directory? Should I just put the index.php in “/”?

    2) I can’t find the .htaccess file anywhere. I am using Filezilla and have “force showing hidden files” on, but I still can’t find .htaccess.

  27. Thank you so much!
    This tutorial worked perfectly for me.
    I was breaking a sweat worrying about this as it was my first time creating & uploading a custom WordPress site but this worked flawlessly. Can’t thank you enough!

  28. THANKYOU!!! You totally just saved me. I searched everywhere and no one explained this in such a simple step by step way like you have here. I’m setting up a clients page and for the first time in all my experience with WordPress it installed in a subdirectory (I still dont know why!), and I had no idea how to fix it. Its all fixed now thanks to you! 🙂

    • Hi Jean-Paul, I’m glad that worked well for you. You are second person to write to me from Cuijk. I will be in Netherlands this summer. Looking forward to being there.

  29. Hi Angela, really a great description and it works fine – within the moved wp-site for the most parts.
    But now, all my other content in the root, from where I moved, is not accessable. (e.g. downloads and other, non wp stuff) and some graphic parts (from style.css?) like list-style-types (bullets) are not shown.
    The path to the “old” root and content is: /webspace/httpdocs/ with several subdir like /downloads
    The path to the wp direcory: /webspace/siteapps/WordPress/htdocs
    What should I do? Clear the old directory and move all content to the new location?
    Have I to add some code for the css?

    • Hi Udo,

      A couple things:

      1 – Any paths in the style.css should not include the full path. Only the path relative to the style.css directory.

      2 – If we are talking about the site, it looks like all the assets are loading from which would be inefficient.

      I’m wondering if you can describe what happened? Were you moving the site to a new domain name? Let me know! I think you would want to change the Settings > General both URLs to the new domain name, then move the site to the folder that is considered the root folder for that domain name, then run the Velvet Blue Update URLs plugin to rewrite all the old URLs to use the new URLs. Let me know if you get stuck.

      • Hi Angela,
        I know what you see is confusing but the background is quite simple. Both domains are pointing to the same host, the wp site (originally only a blog) was in the subdir./siteapps/blog/ and the main site (pure html version) was located in the root /httpdocs/ The main site was primarely adressed as “neptunreal” but you also could find the site under the second domain too.
        Then I built a new site including the “blog” on the existing wp-base using a new theme. Now I wanted to cancel the old html-site and have only access to the new wp-site without the subdir “blog” in the URL
        Looking for a simple solution to do that I found your article. All is fine after following your tipps except that I cannot access the stuff in the old “root”. The issue with the assets I have to clear with the provider.
        Do you really think it will work,, simple copy (move) all the wp content from one directory to the other and then let the Velvet Blue Update URL plugin rewrite the URLs?
        Or should I proceed as I would install a new wp site (what I wanted to avoid).
        Thanks for your suggestions!

  30. Thank you! Thank you! Thank You! After reading all these convoluted method, the dryly written info in the WordPress Codex, and the tech support “experts” from my webhost trying all these crazy htacess rules breaking my site left and right I found your post which JUST WORKED simply and perfectly. I also liked the added explanation of why this is good method for hosting a wordpress site! Well done and expertly written!

    • Awesome, Mike! Yes, this is so super simple. I like to explain it, because it doesn’t require a lot of work and works perfectly fine.

      If you ever DO want to physically MOVE everything, I wrote a post on how to do that as well:

      It’s half a dozen one and six of the other. The method you used is just few steps and fewer things to go wrong.

  31. Hi there
    I’ve been using your excellent method for a lot of sites and thank you so much for an excellent solution.

    I recently had a clients WordPress install that was causing problems that I won’t bore you with. I wondered if a workaround might be to recreate the site in a new subfolder – new install, new database. I’ve done this and just altered the line in the index.php in the root to the new subfolder and changed the settings in the new install. The site shows correctly, the home page header image is using the new folder, but all the internal pages images are coming from the original subfolder, the availability page (it’s a cottage for holiday let) is displaying the information in the original database. I have saved the permalinks and cleared my browser cache. If I try renaming the original subfolder, I get a 500 error.

    Have I missed a step, or have I misused your excellent method in thinking that I can do this? Any advice will be greatly appreciated.


    • Hi Rowena,

      Yes, what you did should technically work. I’ve done the same thing before.

      You might need to rename the .htaccess file and then go to Settings > Permalinks and click Save Changes to regenerate the permalink.

      Did you change the Settings > General URLs to use the new subdirectory for the WP URL and the root for the site url?

      Let me know if you still have issues. I think the .htaccess is probably the issue or any custom links on the pages.


      • Thank you for your prompt reply Angela – much appreciated.

        The subfolder setting is correct in the General Settings. I tried renaming the .htaccess file and the internal pages of the site broke with 400 errors. I had a look at the content of the .htaccess file and there was mention of the original subfolder name. I amended that to the new subfolder and saved it to the site (properly renamed again) – it made no different. The pages are getting their content from the original installation. There is an availability calendar in the site and that content of that is definitely coming from the original database, not the new.

        In case it’s relevant, I tried doing this whole new install because suddenly the site suffered from the issue that some encounter where the WordPress and plugin updates cannot be performed. Apparently a permissions/ownership problem, I could not fix it. So I figured that a fresh install might be an avenue worth taking.

        Thanks for your help Angela – it’s much appreciated.


        • When you rename the .htaccess, the pages will show as 404, of course. So, what you need to do which you may have skipped is go to Settings > Permalinks and click Save Changes. That will create a NEW working .htaccess.

          Please check your index.php file in the public_html folder and make sure that has the correct subdirectory. Right now, it appears to be using _wpgc.

          • Hi Angela
            Thank you. I had saved the permalinks, but the .htaccess was not writeable, so had not recreated. I’ve created it by hand.

            Thanks so much, as someone else said, you are an angel.


  32. Hello,
    I am reaching out because I am stuck. I have backed-up my entire DB, copied the entire html/ file containing my wordpress site to a sub directory of my new site on a whole new server. I connected the new DB in the wordpress config file and used the following .htaccess inside the blog/ which is the stock wp .htaccess.

    However, my problem is the actual rendering site pages/posts and some images. It cant seem to find them, and seems to be re routing the blog pages to as opposed to, which is only making matters worse.

    Can you help with this?

  33. Hi Angela,

    Just thought to give you kudos! This tuto has helped me multiple times on setting my friends & fam wp-blog, now it helps me once more. You’re also very kind & thorough on your replies, thank you!

  34. Hi Angela,

    So I have a new WordPress site for our gallery in a subdirectory (/wordpress). I’ve attempted making it the main site with the directions found at the top of the page, which I initially found here: Both, “Moving a Root install to its own directory” and “Using a pre-existing subdirectory install” came back with the same results. “/wordpress/wp-admin/” brought me to an admin page with no styling. After submitting credentials, I was redirected to a page (path no longer contained “/wordpress/”) that could not be found. “/wordpress/wp-login.php” could not be found. The index.php page appeared, but with broken styles. Some images appeared, some did not (see screenshot here: Javascript functionality was also broken. I looked at the code and noticed the images that rendered correctly had permalinks referenced “/wordpress” (see screenshot here: The other images, styling, javascript, etc., that did not function, referenced the root folder (see screenshot here: I guarantee that I went through all of the initial steps correctly, as I’ve done them multiple times alone, with my hosting provider and with WordPress support (via forums). To note, my site does not have a .htaccess file—just a web.config file. Although, I have tried creating a .htaccess file and added the rewrite code, but had no luck. Another thing to note, the site is on a Microsoft-IIS/8.5 server.

    I’m wondering if my custom permalink structure has anything to do with this. I’m using “/%category%/%postname%/” in the WP dashboard.

    WordPress support is asking me to try downloading all of the old site files, then delete them on FTP so that the /wordpress folder is the only site there. I’m not sure this is the right thing to do or not—he even said “this is a bit radical.” Anyways, you seem awfully knowledgable about the subject at hand. Could you please provide some guidance? I’ve been troubleshooting this issue for several days now and the gallery I’m working for is getting antsy, as we were supposed to launch last week.


    • Hi Paul,

      It looks like you have things back to where you started with WordPress still in the subdirectory. You commented on my post: which has the step-by-step instructions for keeping WordPress in the subdirectory but allowing the URLs for your posts and pages to show from the root. With my instructions, you would still login to the site via the subdirectory, but you should see all the URLs show from the root of the site.

      Because sometimes people might make a little typo or encounter other errors with this process (usually as the result of some small typo), I created this FAQ:

      At any rate, I can usually solve these issues in under a half hour – sometimes in just a few minutes. I’m heading out now to a meeting, but I can help you when I return. Please email me via my contact form: I’ll reply back to get your WordPress credentials and web hosting login. I can accept payment via Paypal for my time, which should be minimal.


  35. I cannot find any line in the index.php files that has the words “wp-blog-header.php” anywhere.

    How many index.php files are there supposed to be and where are their locations?

    Found one that already had the Silence is Golden entries.

    And when you say to copy one file to the htdocs folder, which one of the index.php files should be copied? And is there any other line that should be changed if I can’t find the wp-blog-header.php file?

    Thanks much for any help.

    • Hi,

      The index.php file I’m referring to is the one in the main WordPress install – so the highest level of the WordPress installation where the wp-admin and wp-includes folder are. Yes, there are many index.php files that serve different purposes. This one controls the root level of your site.


      • I don’t have “many” index.php files, not that I have seen. I only have two index.php files, and they are in the wp-admin and wp-content folders (which are in htdocs). Other wp files are in a subfolder called leespad. The index.php file that is in the wp-content folder is the Silence is Golden one. The one in the wp-admin folder is code, 6 printed pages of it. Is this the one that should be copied to the htdocs folder? As I said, I cannot find any line in that file that has “wp-blog-header.php” in it. Again, is there some other line that should be changed, since I can’t find this particular line that you say to edit? Should I add this line somewhere? I do not know code but I could try with an example to follow. Thanks much for any help that you can be in helping me to get this website going. Right now, my old website comes up. I have the WP website ready but can’t get it come load instead of the old site.

        • index.php files are found in many folders of the WordPress installation including the ones you have noted.

          The one you will need to copy and move to the root directory (aka public_html directory) is the one that is with the other WordPress installation files. This is at the same level of as the wp-admin, wp-includes, and wp-content folders but NOT inside those folders. In your subdirectory where you have WordPress installed there are the following files:

          .htaccess – invisible file
          index.php – this is the file you will need to download and upload to the public_html folder and modify the require line
          wp-admin – folder
          wp-content – folder
          wp-includes – folder

          • Sorry, but neither of your replies to my inquiries was what I needed or was looking for. However, the good news is, after several hours, I was able to figure it out myself and the site is now online. I think there was a bad installation. There was no index.php file in with the three main wp folders. But I found one that worked after I moved it and changed a line in it, along with changing a path in the Dashboard and making sure the pointer was right on the web host’s control panel.. I never found an index.php file with the line “wp-blog-header.php” reference in it. The three main wp folders are in two places, but since it works, I won’t mess with it any more. I did several things and don’t remember a lot of what I did, but finally got the right combination of things. to make it work.

          • The index.php file that is referred to in this post is NOT in one of the WP folders. It is in the main installation of WordPress — NOT in the wp-content, NOT in the wp-admin, and NOT in the wp-includes folders. EVERY WordPress site has this index.php file in with the main installation files. There is not a single WordPress site in the Universe that doesn’t contain this file.

            At any rate, I’m glad you finally found it and figured it out.

  36. Angela, that was just tooooooooooooo easy!

    Many thanks for such a great article. I got in touch with you about 6 months back when I was in the early stages of converting an existing static html site to wordpress. I completed this over Christmas and just flicked the switch with the help of your instructions – it’s great to have it over and to now have the flexibility of the new platform.

    A few questions popped into my mind whilst doing it:

    Are there any disadvantages to using this quick method as opposed to your more detailed ‘full move’ method. Are there any gotchas coming down the track as my site develops?

    I’ve set up 301 redirects using the Redirection plugin. I have another plugin which can apply compression to my site by adding code to my htaccess file……. is this likely to affect any redirections set up?

    Does EVERYTHING now see this site as present in the root as opposed to a sub directory? I’m thinking about things like analytics tools, search engines etc?

    Thank you again – you are a legend.

    • Hi Stephen,

      All the page and post URLs will be from the root. Your login and any files uploaded to the Media Library will display from the subdirectory, hence why your subdirectory should be a professional-sounding name (not test or dev). I usually make the subdirectory something benign, like the initials of the company.

      Otherwise, from an SEO standpoint, there isn’t really any downfall if you do all your 301 redirects from the OLD url for the posts to the new one. This is hard to do wild card because then you might get the wp-content media items as well, which would not be good. So, I would recommend doing the rewrites singly unless you have some good .htaccess fu.

  37. Hi Angela, thanks for the information. I run a website and while setting up WP via Softaculous, I kept everything to default and then realized it actually installed in a subdirectory /wp. So then my website URL was However, instead of installing it again I solved the problem and somehow managed to move the files to the root directory and got my website URL to and made changes in the Settings option in WP admin portal. Although my WP installation and website are in the root folder, whenever I install a new plugin or make changes, they take place in /wp folder and not the root directory. So I manually need to transfer the plugin folder to root folder. For instance from “/wp/wp-content/plugins/example_plugin” to /wp-content/plugins/example_plugin” using FTP from CPanel. Everything was fine until I lost my Google Adsense plugin control due to instability and Ads won’t show up. I have been troubleshooting the problem since last week. I think the situation mentioned above is creating this problem. I don’t know what I was thinking, but I replaced all the files and folder from /wp folder to root. Anyways, I want to make root directory as my default directory fro WP so that I don’t need to replace the files whenever I make changes. What am I missing here? What should I do to make the root directory as default directory?

    • Hi Sarang,

      If you MOVED all the WP files including the wp-content folder to the root and changed the Settings > General URLs BOTH to the root URL, the plugins should no longer install in the subdirectory. Be sure to check the index.php file on the root install and make sure it doesn’t have the subdirectory listed in the require line and also check your .htaccess file and make sure it’s not redirecting the site to the subdirectory, which I doubt is issue but good to check. Lastly, check your wp-config.php file and make sure it is not referencing the subdirectory either.

      Do you have any files in the subdirectory at this point? You might try moving the subdirectory folder way up above the public_html folder — to the root of the hosting account — to just get it out of the way while you troubleshoot.

      • Thanks for the reply. I solved the Google Ads issue. It seems I enabled PageSpeed from CPanel and that’s when I lost Ads. Now that I have solved it, I am focused on the WordPress issue. So I use Yoast SEO plugin and created a robot.txt file and found that the robot.txt file has this code:
        User-agent: *
        Disallow: /wp/wp-admin/
        Allow: /wp/wp-admin/admin-ajax.php
        Should I go ahead and remove the /wp from the code and save it?
        At this point, I am too afraid to do it because I can’t afford to lose my site again. I have crashed my site many times before solving this issue. I have moved everything from /wp to root i.e., in public_html

        • Okay, that makes sense. I have removed all the disallows to the wp folders. The only thing I disallow is indexing of a folder I have that contains some images I don’t want indexed. Here’s what Yoast says about this:

          Blocking your /wp-admin/ folder

          In the comments many people asked whether I think you should block your /wp-admin/ folder. I think you shouldn’t. The reason is simple: if you block it, but link to it a few times, people will still be able to do a simple “inurl:wp-admin” query and find your site. This type of query is the type of query malicious hackers love to do. If you don’t do anything, WordPress has (by my doing) a robots meta x-http header on the admin pages that prevents search engines from showing these pages in the search results, a much cleaner solution.

  38. Wow!

    You are my hero! I can’t believe that something so simple has been made so complicated on the internet. I just moved my index.php file and it took all of 2 minutes but the other resources I saw on the internet were just insane (requiring a move of ALL files and creating new directories etc etc.)

    I am so glad I found your site! I will be a regular now 🙂

    You absolutely rock!

    • Hi Penny,

      I do love this method. I wrote another blog post explaining how to do it the “hard way” because some people don’t want to live with the subdirectory for the upload content. But, I’m with you! I’m glad there is this easy way to do it!


  39. Thank you so much for this post!

    I was so frustrated with this url problem and my hoster’s support about it is so imposible to understand for people who barely know about this subject… finding your post made it so much simplier and understandable and saved my day 😛

    Glad there is ppl out there giving a hand on this. Great job and thank you once more!

    • Hi Amanda,

      In your case, I don’t recommend using capitalized letters in your subdirectory as that could cause a lot of issues with various themes and plugins when you try to show pages and content from the root. They may not be able to find their files because they assume a lowercase lettering.

      To make the new site live, since you have to not use that subdirectory anyway, I would do the following:

      1 – Move all the current HTML files from the old site into a folder.

      2 – In your General Settings, change both fields to use the root domain name, e.g.

      3 – Physically MOVE ALL of the WordPress files into the root (public_html) folder.

      4 – Login to WordPress and install the Velvet Blue URLs plugin and do a rewrite of the URLs from the old subdirectory URL to the new URL.

      5 – Go to Settings > Permalinks and click save changes.

      6 – Check for any Custom Menu items under Appearance > Menus. Be sure your home page link uses the root URL.

        • First, subdomain is different than subdirectory. A subdomain is set up as a “subdomain” in the hosting control panel and displays as A subdomain will typically live inside a subdirectory of your hosting account, but that is not the same as “installing WordPress in a subdirectory.” Installing WordPress in a subdirectory does not require setting up a subdomain and simply is an installation inside a subdirectory of the primary domain, e.g.

          Most hosts will NOT support redirecting the document root of the primary domain to a subdirectory, hence why your two choices for getting your WordPress installation that is inside a subdirectory to show the URLs from the root would be to physical MOVE the entire installation to the public_html folder OR do the process I’ve outlined here. Many people may have installed WordPress inside a subdirectory because they had a static HTML site to start with and installed WordPress as a “blog” but now want to use WordPress as their main site.

          Some hosts may allow you to point the primary domain to a subdirectory, but you should check with them first.

  40. Great instructions – thanks for posting this.

    I was upgrading from a Drupal site to WordPress. I put the Drupal site in offline mode, then went into cpanel and created a folder called something like drupal_site_old. Then moved all the stuff pertaining to the Drupal site in there. Then followed the instructions for moving the WordPress development site to the root.

    The only hitch was the backup plugin recommended. It hung up and didn’t work for my WP 4.31 site. Updraft Plus worked fine.

    • Thanks for the tip on Updraft Plus. I am going to write a more comprehensive manual for “migrating” WordPress, as this post is one very specific method, but people usually need more step-by-step instructions for other methods such as really “moving” the install. There are a few ways to handle that, and using Updraft Plus, Duplicator, or BackupBuddy or other Migration plugin are options to physically MOVE the install the public_html directory and have the plugin rewrite all the URLs automatically.

  41. Hi Angela,
    when setting up my site 2 years ago, I had moved WP into a (fancy named) subdirectory because I had read somewhere that this is more secure. In the meantime I had started to wonder about this argumentation as I noticed that all my images showed my “secret” fancy wordpress folder name.
    You actually mention this on the top of your post:

    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,

    Anything new you can say to this? I’m now thinking of moving all my images to a new folder in root or maybe even to a subdomain to avoid this problem.

    Interested to hear your opinion about this.


    • Hi Michael, That’s a very good point. Many bots will target the main URL with /wp-content to get to vulnerabilities in themes and plugins. However, the bots have gotten smarter and might be able to dig deeper into the site anyway. Also, security through obscurity really isn’t security. I’m in the process of writing a bunch of how-to tutorials on “moving” and “migrating” WordPress since some people don’t want to keep the install in the subfolder. My purpose for writing this tutorial is that many people do want to keep the site in the subfolder but just show the URLs from the root, and at the time, the only tutorial out there was on a site that had been hacked.

      At any rate, the subfolder name is NOT secret, and I never would have suggested that it is, because it can be easily seen in the URLs for all uploads, themes, and plugins. I might have that more clearly elucidated in the FAQ post. The main purpose for keeping WordPress in a subdirectory is for convenience and to keep the root directory clean in case you have other WP installs or subdomains on the same hosting account (which isn’t a great idea anyway). The potential security benefit is more for bots looking for the wp-content folder at the root, not that you can’t see it or find it.

      So, yes, by all means, you can MOVE the ENTIRE WordPress install to the root aka public_html directory. To do this:

      1 – Go to Settings > General. Change BOTH URLs to show from the root with no trailing forward slash, e.g.

      2 – In your FTP application, MOVE everything out of the subdirectory to the root of your install.

      3 – Login to your site and install the Velvet Blue Update URLs plugin and rewrite all your URLs from the subdirectory URL to the root e.g.

      You may have broken 404 links to uploaded images if people linked to those externally (which they shouldn’t).

      You can also use regular expression in the Redirection plugin to rewrite the previous uploads folder contents to the new url for the uploads folder.

  42. Hi Angela,

    Great article! A couple of questions for you. First, I haven’t set up my company’s website yet, but I do know that there will be two versions. The first year will be for marketing and, after that, a second site or version will be launched for operations (the first site will be removed once the second is live, but the second will be in development while the first is live). We will be using the same domain name for both, so does it make sense to set up both sites in separate directories? My second question pertains to a SSL. As we want to remain secure to avoid malicious hits and hacking, are there any issues I should keep in mind while installing a security certificate and dealing with wordpress in a subdirectory? If this is my approach will using subdirectories force me to install wordpress twice in both directories? Is that even an option? I really don’t want to go the wordpress multisite route as, in the end, only one site will be live at a time.

    Thanks in advance for your assistance!

    • Hi Tony,

      There are a couple ways to approach this:

      1 – Simply install WordPress in the root for the first-year site.

      2 – Install the dev site in a subdomain (which will technically live inside of a subdirectory on your server) and migrate from the subdomain to the root when you are ready to go live with that site.

      The reason to perhaps start and stay in the root is to avoid having 404 errors on any uploaded files. By not switching directories, you have a more seamless transition. The reason for my post is that so many people started to build their sites in subdirectories and then couldn’t figure out how to show it from the root. It’s also not a bad thing to do. However, I’ve recently started hosting a lot of my sites at WP Engine, and they don’t allow subdirectory installs. If you think you will migrate at some point to a managed WordPress host, having the install in the root would be easier all around.

      As far as SSL, the SSL typically applies to the primary domain for the site, regardless of where the WordPress files are living — it covers the whole root domain. What the SSL will NOT cover are subdomains. You would need to purchase a wildcard SSL that will cover all domains, including the subdomains, or get a separate SSL for any subdomains.

      I hope that helps! Let me know if you have more questions.


  43. Cancel what I said about not being able to edit my posts/pages and preview posts before they’re published. I learned that after I logged out, and then logged back in, that the problem was resolved.

    It’s a good thing I realized this before I went to the trouble of moving those core files and messing with the permalinks again. Whew!. 🙂

    • Yes!!! Oh my goodness. Glad you did log out and log back in. I’ll make a note of that on my post. The cookies can get confused when you switch things.

  44. As many others here have said, thank you for a well explained and easy to follow instructions on this subject. My hosting site is which does not allow wordpress to be installed into the root directory. I went ahead with installation in a subdirectory and began designing my new site without any idea how to replace the old site once I was finished. This did the trick and only took about 5 minutes which is amazing considering I had no WordPress knowledge just a few weeks ago.

  45. Hi Angela,

    Thanks for all you do.
    I followed your instructions and dozens of others but still can’t shake that “wordpress1” that sits at the end of our domain. displays fine without “wordpress1” but when you type you still get
    Any advice or fix would be greatly appreciated.

    Thank you so much!

  46. Our development site was built (stupidly, I now realise) in a subfolder called /blog.

    What is the best way of changing this directory name and moving the site to root please?!

    “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”


    • Hi Lindsey, You wrote to me directly via email, so I can reply there as well.

      In terms of getting you out of this mess, you can edit your URLs back to what they were in phpMyAdmin wp_options table. I have the instructions in the post. Once you do that and can log back in, you can do one of the following:

      1 – Actually MOVE the site out of the blog folder (change General Settings to the root domain name, then move all the files to the public_html folder, login again, and run the Velvet Blue URLs plugin to rewrite all the URLs on the site).

      2 – Or rename slug aka permalink for the page called blog to something like our-blog and repeat the process in my post, and you won’t have the conflict.

      I hope this helps. Email me if you get stuck.

  47. Thanks for the well explained post. I’m having a challenge however. I can’t find the site url or address under the general tab of admin settings panel. Just the site name, email and others. Please help me out. Thanks

    • Hi, it sounds like you probably are running a site on multi-site in which case these instructions won’t apply.

  48. Really, thanks. Your presentation was very clear and everything worked fine! I was getting very upset reading other sites, including I was enlightened I stumbled on your site!

  49. Thank you so much for these clear instructions.

    I’d read loads of others sites and I was TERRIFIED of doing this, but thanks to you I’ve done this no problem!

  50. Hi, just two questions before I try it please.

    1. Does the original index file residing in the sub-directory absolutely need to be replaced by the Silence is Golden index file or can it left there unedited, as is, with an appropriately edited copy placed in the root?

    2. Pretty Permalinks: If I have been using them, do they need to be turned off at any point in the migration process?

    TIA! EE

    • Hi Elke,

      The index file that is originally in the subdirectory can stay there. No need to replace it with a Silence is Golden file. But if you MOVE it, you will definitely need a Silence is Golden file to prevent people from being able to list the contents of the subdirectory. Index files basically prevent directory listings by outsiders.

      I haven’t ever needed to turn off the Permalinks. Sometimes, I’ve needed to go to Settings > Permalinks and click Save Changes to have WordPress write the .htaccess where it wants it.

  51. Hi,

    Could you please assist me with this?

    I moved my WordPress sub-directory into the root folder and realized that it wasn’t the correct way. However when I moved it back to the original sub-directory and opened the link, the site has lost is formatting and now displays all wrong! Wha can I do to fix this?

    • Hi Lindley, Sorry for the late response. Can you contact me via my About page? I can probably help if you need some help.

  52. This is a great and helpful article, thanks.
    I am in the process of replacing an old html site with a wordpress site, and I’ve successfully installed WP in a new subdirectory, and intend to eventually do as you’ve instructed here.
    However, there is already an earlier installation of WP for a separate (although related) fully functional site in this same public_html folder, and the directory for that one IS in fact called “blog”. (uh oh!) I can’t actually change that, (it has another subdomain pointed at it, and lots of outside links to it as ‘/blog’.) Maybe I have shot myself in the foot with this?
    But what I’m hoping is that maybe you have some idea of a workaround or a way of setting things up in the NEW, second WP installation, (in which I haven’t even written a blog entry yet) so that it doesn’t mistakenly go looking in to the other WP installation directory called ‘blog’. Is this a possibility?

    Thanks very much for your time!

    “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”

  53. Hey Angela!

    Thanks for the great article!

    Helped a ton!

    One question though(although it does already work):

    Whats the difference between require( dirname( __FILE__ ) and the one you are describing?

    Is it ok if i leave the require( dirname( __FILE__ ) rather than php require?

    Thanks in advance.


    • Hi Themis,

      Thanks for pointing this out. The more current version of WordPress uses:

      require( dirname( __FILE__ ) . '/wp-blog-header.php' ); without the opening and closing PHP tags. So, yes, you can use the line that is in your file. The main thing is to add your subfolder name to that line, so it reads:

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

      Substitute the word subfolder for your subfolder name. What this does it tells WordPress where to find the WordPress application (as well as your themes, plugins, and uploads).

    • Oh, and now I realize you are referring to dirname(_FILE_). This was modified in WordPress core after I wrote this blog post because a core contributor felt that it was better practice to use the absolute rather than relative path. The dirname(_FILE_) uses the absolute path which resolves some issues on some servers such as Windows servers. For most people, this won’t make a difference, but for those that it does, using the new include line will work better. Here’s the WordPress core trac ticket about this change:

  54. Hi Angela,

    Great article, thanks for posting this.

    I have a static html site of approx. 25 pages. I have selected a theme and all I really want to do is move the pages over to preserve the domain SERPS. I am happy to recreate the pages by copy and pasting content the manual way given the small size of the site, but I just want to ensure that I am able to redirect traffic from old to new.

    I think I understand the concept of htaccess and 301 redirect but the thing stopping me is not understanding how the old homepage will be dealt with (index.html). I was looking to use the HTML Import 2 plugin to move my HTML pages to posts or pages in WP, which also generates a .htaccess output.

    If I install WP and generate the new pages and posts with the plugin in a sub dir as per your instructions how does this affect the redirects from the original root site pages?

    In short, I am dying to get it moved in the simplist way possible so I can get cracking in WP, but don’t want to hurt the serps as the site is 4 years old. I’m happy to not use the HTML Import 2 plugin and do it totally manually as long as:

    1) I can handle the redirects correctly
    2) I can make it look like it still sits in the root URL

    Any help you can offer would be a god send! I just don’t want to overcomplicate what might be a simple problem?



    • 1 – Install WordPress in a subdirectory so you don’t mess up your current site. You can’t have both running from the public_html (root) directory. Name the subdirectory something you can live with (as this will show if people see the source URL for images and uploaded files). I often use an acronym of the company. Lowercase and one word is best.

      2 – Copy over your content from your old site into new WordPress pages. WP Beginner has a great free video series for you to understand the basics of WordPress: You have to give them your email, but that’s all. As you work on your new site, you will view all the pages from the subdirectory (don’t worry – this will be temporary). Also, go to Settings > Permalinks and choose Postname as the permalink setting. This will make all your URLs be “pretty” and use words instead of numbers.

      3 – Make a list of all your old (static HTML site) URLs in a Word doc or Excel spreadsheet or Google doc.

      4 – After you feel confident that your new WordPress site is what you want it to be, you can use the process I’ve outlined in this post to go live with the new site. You should place all your old html files (including the old index.html) inside a folder in the public_html folder so they don’t interfere with WordPress. You can download and then delete this folder once you are sure the whole process went fine.

      Make sure all your pages now display from the root. You may need to modify any internal hyperlinks you created.

      WordPress will still live inside the subdirectory, but all the pages and posts will have URLs from the root directory. Your uploaded images and documents will show the subdirectory in their URLs, and that’s okay, because the wp-content > uploads folder where they are will always live in that subdirectory.

      5 – Install the Redirection plugin for WordPress Using this plugin, you can quickly and easily add each URL you made note of in step 3 above to the Source URL field and enter the NEW WordPress URL in the Target URL field. This automatically creates a 301 redirect! Super simple! You do NOT need to do any funky things in .htaccess to make this happen. This plugin creates all the redirects for you. All you need to know is the old url and the new url. By doing this, you will retain all the SEO value of these pages. Their SEO value will be applied to the new page.

      I am available for hourly help if needed or just write back here.

      • Hi Angela,

        You are a complete legend! Thank you so much for taking the time out to map these steps out, it really means a lot.

        I’ve already started with the sub-directory installation as per your instructions and will start copying over the content next.

        Really excited to get this site over and be able to update it more easily.

        One other thing that is niggling me. Is there anything special I need to do in terms of the home page and bringing this over into WP? I keep seeing the terms index.html, index.php, home.php etc. I know you can set a static page within WP. Just want to make sure I do that correctly

        Also, should the old content coming over be built as posts or pages within WP….. or is this just personal choice?

        Thanks again for all your help on this!


        • Hi Stephen,

          That’s awesome!!!

          The main WordPress index.php file is basically what drives WordPress as a whole and isn’t related to your home page per se. The contents of the WordPress index.php file points to the WordPress installation, and then WordPress takes everything from there.

          What this all means for you is that when you go live, you will follow the process I outlined which involves putting a COPY of the index.php file that is in your WordPress directory (which you have in a subdirectory right now) and editing a line in that file that lets WordPress know that your WP application is in the subdirectory. That’s all.

          In the public_html file when you go live, you’ll just have the following:

          cgi-bin (which is a folder on most hosting accounts)
          index.php (which is the copy of the index.php file from WP edited per the instructions in my post).
          old (which will be a folder you’ll create to put all your static HTML files)
          subdirectory (the folder that you WordPress install is in)

          That’s usually it!

          So, keep working on your WP site, and then reach out when you are ready to go live.

          As for pages versus posts, pages are typically more static content: about us, services, contact, etc.

          Posts are usually news or timely items: press releases, announcements, events, etc.

          I imagine if you had this set up as a static HTML site, most of your content will be pages and maybe pages with subpages.

          Good luck!


  55. Hi Angela, thanks for the information here. I think I have a slightly different twist on this problem. I have WP installed in the larsonfamilymortuary subdirectory on the site and do not want to move it. The “live” site currently is on Godaddy, and that site is not a WP site at all. After putting the WP site into order, I want to switch the name servers over to Hostgator and let the world find the new WP site.

    I have already set up an add-on domain in Hostgator pointing to that directory.
    Is the rest of it as simple as just changing the Site Address URL to

    Seems like there should be more to it.

    Thanks for any comments.


    • Hi Joe,

      Yes, if you add the domain as an add-on domain and point the domain to the subdirectory, you should just have to change the Settings > General to be

      However, you should also use the Velvet Blue URLs plugin to rewrite all the URLs of uploaded images, files, and internal links from the old subdirectory URL to the correct URL.

      Good luck!


      • Thanks for the update Angela. I managed to ignore my own notes and changed the WordPress URL instead of the Site URL, and all the pages disappeared, but a run through with the Velvet Blue tool brought everything back. After that I went back and changed the Site URL like I should have done the first time. Everything is working now and the links all look correct to the end users. Making a note to read my own directions next time. The next project is to copy the whole site over to a secondary folder somewhere so I can have a testing version to play with. For that I’ll go back to your original post and this time follow the directions.

        But thanks again. I appreciate all the great knowledge you give out.


        • Hi Joe,

          For duplicating the site, I highly recommend the Duplicator plugin. You just need to run the plugin to “Package” your site, and it will make a full copy of the database and all the files and zip them up.

          Then, you will download the zip file and the installer script and upload them to the folder where you want to have your staging environment.

          You will visit that folder URL/intaller.php and you’ll be guided through restoring a copy of the site in the subfolder. The only technical thing you need to do is use your web hosting control panel to create a new, blank database using the MySQL Wizard. Take note of the database name, username and password. I should write a blog post about this!

          Good luck!

  56. Thanks so much for writing this. I am getting ready to finally step out of my safety bubble and abandon my iWeb built biz site, which has served me well but it’s time to move on. I have played with WP over the years on various other website ventures but have dreaded the idea of some how cleanly making the switch on my main biz site. Your article has made the impending transition look much less scarry. I do have one question.
    Once I build my new wp site on and follow the steps and make it go live as to replace the iWeb files that currently reside there, when some one visiting my site goes to check source on a page will the code read as…. or will it remain as…. ?
    Thank You!

    • Hi Marta,

      Good for you! You can do it! Sometimes the only way to get confidence is to make mistakes. The only way to learn is from mistakes. You can’t expect to execute perfectly. I learned a lot from breaking things badly. 🙂

      As far as your question about the source code:

      1 – All your post/page URLs will display from the domain root
      2 – All your uploaded images, documents, and PDF URLs will display from the subdirectory – hence why I name my subdirectories professionally, never using the words ‘test’ or ‘dev’ — I often use the initials of the company.
      3 – WordPress still lives in the subdirectory, so you’ll login to the WP dashboard still through the subdirectory.

      Good luck!

  57. Hi Angela,

    Thanks for this post: really helpful. I followed this successfully for a website last year.

    However, I am having problems with a new website (which uses a different theme).
    After following your steps, the homepage won’t display correctly – it displays the headings, text, images, links etc but looks as if it’s missing its template or css.

    I can’t figure out what the problem is and have tried various things. The interesting thing is that I can get it to redirect and display correctly my homepage if I leave my wordpress general settings as is but this means the reference to the subdirectory appears. I’ve tried everything I can think of and checked out your FAQs and looked up online.

    I did come across a suggestion by yourself that it might have something to do with the theme files urls. Do you have any suggestions on how to fix this? I may need to do this again with other websites in the future. I’m not sure what to look for in the theme files.

    I would be grateful for any suggestions you may have.



    • Hi Ruth,

      Please comment back with links to screenshots of the following:

      * content of the index.php file in the public_html folder
      * Settings > General page in WordPress
      * the rewrite rules for WordPress in the .htaccess file

      You can upload images at

      Did you have a caching plugin installed and activated before you did this process? If so, you’ll need to be sure to delete the cache and reset up the caching settings as they need to be updated to work with the new location.


        • A couple quick thoughts, capital letters in directory names can be troublesome. I also have been using this line in my index.php file:


          And not using the dirname.

          So, it’s best practice to NEVER use CAPs in your directory names and perhaps try the simpler require line.

  58. Thanks so much for the instructions, Angela! Everything worked like a charm except a little issue which I think you’ll be able so help me with very quickly.

    With a .htaccess file in the root directory that has been freshly created through Settings – Permalinks (postname), I am unable to log in to my admin dashboard. However, if I delete the .htaccess file in the root directory (or use the default permalinks setting) I am able to log in to my dashboard.

    All other links and sub-sites work fine, no matter if the .htaccess file exists in root or not. I tried adding the WP-sub-folder (“RewriteBase /wordpress/” and “RewriteRule . /wordpress/index.php [L]”) in the .htaccess file with no luck (dashboard was unreachable again – 404).

    Any clues?

    Thanks so much!

    • Hi Toby,

      The .htaccess should not have /wordpress in the rewrite rule. It should look like this:

      # BEGIN WordPress

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

      # END WordPress

      Delete or rename any other .htaccess files you have in your wordpress folder or public_html folder and make a new blank .htaccess with the above text in it.

      Check for typos in your index.php file. Read the FAQ to this post as it will help you discover any mistakes.

      Also, check your Settings > General page. Sometimes people put an extra ending / after the WordPress URL. Neither URL should end with a /.

      It will be one of these three things, though I suspect it is a combination of your Settings and wrong info in .htaccess.

        • Thanks Angela for your fast reply!

          I deleted the old .htaccess file in the root folder and replaced it with your text above. Everything works with this method, except the pretty permalinks. As soon as I change the permalinks to %postname% again, WP rewrites the .htaccess file and it is not the same as your text above anymore. I would like to have those pretty permalinks, if possible.

          I checked my index.php file in the root and it has the correct subfolder in the request tag. BUT the request line looks different than yours posted here. Since I am a newbie when it comes to PHP, I’m guessing they do the same thing and WP updated the style of writing the code over time.

          Here is my current require line:
          require( dirname( __FILE__ ) . ‘/wordpress/wp-blog-header.php’ );

          And here is your suggestion on how to write it (obviously changing the ‘mywp’):

          Which require line should I use?

          I also checked the slashes in my Settings > General and they are all fine. In your post you don’t have any “www” but if I only write “” my website can’t be reached at all. So I need to keep the “www” in.

          Any other clues?

          Thanks so incredibly much!

          PS: When I say “root” I am referring to the “public_html” folder, so one instance above the “wordpress” folder.

          • Hi Toby,

            Yes the index.php require line should read:


            Be sure the quotes are straight quotes and not curly quotes.

            The fact that it has the dirname in it will cause issues. So, fix that.

            The .htaccess in the public_html folder should not include the subdirectory in it, so you can manually fix that.

            The WordPress URL should be your site name with the www and include the subdirectory with no ending slash.
            The Site URL should be your site name with the www and not include the subdirectory with no ending slash.

            Let me know what happens. Are you on Windows hosting by chance?

  59. I want the site url to go to the wordpress folder
    I get when I try to login and when I type in I get this:
    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    I have an old flash website I am going to have to turn on by reenabling index.html So you won’t see the error I talk about unless you go to

  60. Hey Angela 🙂

    Wow, this is brilliant! I cant tell you just how many times we have created/maintained sites on sub-domains and then preformed a ”full-on’ migration to finish off. Needless to say; your method is much more proficient, and elegant too 🙂

    The tutorial you posted was extremely simple to follow, yet informative enough to teach us all a very useful lesson (probably the best example of a well thought out topic and post I have seen on the net this year!).

    In-fact I followed the steps with a site I was working on, and it went off without any issues, and I was done within around 20 mins :). There is just one small ‘speed bump’ I am trying to get over;

    it seems the site is not picking up any of the icons (replacing them with squares instead)

    is it possible that I may need to copy a css file over to the route as-well? I am using a custom theme (avada)

    If you dont mind taking a quick “look-see” ( – and scroll all the way to the footer, you can see an example of the icons replaced by squares, where social networking icons should be.

    you can see the working version on the subdomain (

    Any chance you have seen something like this before?

    I look forward to any advice, if possible,

    Thanks so much once again for the epic post, and thanks in advance for any advice to come 🙂

    Best regards


    • Hi Ashton,

      I work with Avada. Yes, I’ll check this out. I totally see what you’re talking about. I’ll email you back later tonight.


      • Hey Angela,

        So sorry for the late reply, I went away for the weekend,

        I really appreciate your response, and will be so so so happy if you have any advice for me to move forward,

        again, thanks for taking the time, I really appreciate it!

        Hoping you have a wonderful day 🙂

        Kind regards


  61. Dear Angela,

    I have followed your tutorial to the core and am still unable to point my website “” to “”. I installed wordpress through godaddy applications and then followed your instructions as they were.

    When I open the site with /wordpress it opens fine but without it , it goes to a MAINTENANCE page with greyish empty display. I have been working on it using many different tutorials and the result have been the same. On top of everything I couldn’t find the .htcaccess file in FILEZILLA client even with “FORCE SHOW HIDDEN FILES”. Changing the permalinks style didn’t help either.

    Please please please pleaseeeeeeeeee help me with this 🙁

    • Hi Hassan,

      I’m sure I can help! Can you please email me your me your GoDaddy login and your WordPress login information to my contact form at

      I have to go to an appointment soon, but I can look at it in about 90 minutes.


  62. Hi Angela nice post!
    I would like to know if you can help me out here…
    Here is the situation I have now…

    I have my pointing to my subdirectory1 at my hosting. This is my my domain that I want to keep up.
    I have my pointing to my subdirectory2 at my same hosting. This is a test domain I have and I installed a new fresh wordpress with a new theme and now it is ready to change for domain1.

    I want to get my new fresh wodrpress at subdirectory2 poiting to

    What I tried…
    I changed the wp url and site url from the wp subdirectory2 to point to the
    I rename the sudirectory1 to another name, and then I renamed subdirectory2 to subdirectory1.
    Results: The site show up… Some link images broken, but the main problem is when I tried to log in at wp-admin.. I loads and gave me a blank page and I cannot acces the admin panel.

    Do you have any clue how I can solve it?

    • Hi Leandro,

      I understand what you are saying, but I think I would need to look at it to see what might be going on, especially with the domain name pointing. It’s possible that those WordPress settings need to be different depending on if the domain is actually pointing to the subdirectory or the root directory. It’s possible those settings needed to just be for the instead of Or maybe it’s just a typo in the Settings > General.

      Though, it would take looking at how the domain is pointing and what the settings are in phpMyAdmin at this point.

      Shoot me an email with your WP login and web hosting login, and I can take a look this evening:


  63. Hi! I’m not too sure how the QnA format works so I’ll just post my question.

    I am working on a wordpress site that was placed in a sub-directory.

    I have managed to make my site appear as if it was located on the root directory (as this article spoke about). However, when I try to access wp-admin, my subfolder name is still appearing (e.g

    My question is if there is a recommended method (if any), to remove it for the admin pages as well (e.g or instead of

    I look forward to your response and thank you in advance for any assistance you could provide. =D

    • Hi Adam,

      No problem. Your commenting is a perfect way to ask a question.

      The wp-admin folder is technically still in the subdirectory, hence why you need to access the WordPress Dashboard via the URL that includes the subdirectory.

      The process I’ve outlined is best used for new installations and development environments. It allows you to “go live” with a site installed in a subdirectory without having to do a bunch of URL rewrites of images, uploaded files, settings, etc. (except to hyperlinks to interior pages). I almost always install WordPress in a subdirectory, though this doesn’t work with some premium hosts like WP Engine.

      The benefit to a subdirectory install is that it keeps the root directory clean in case you are hosting other domains on your same shared hosting account and for creating a new site while an older, existing site is still active.

      I typically name my subdirectories something I can live with, like the initials of the company, rather than something embarrassing like “dev” or “test”. This is because 1) We will still need to login via that URL even after go live (making the pages show from the root), and 2) people may see that URL if they view the URLs for any uploaded files, such as images or PDFs, since the wp-content/uploads folder is still in the subdirectory.

      Basically, what this process does is keeps WordPress in the subdirectory but tells WordPress to show the URLs to pages, posts, categories, etc. from the root.

      I hope this helps make sense.

      If you did have a not-so-great subdirectory name that you’d like to be rid of, you can do the following:

      1) Change your Settings > General to use the root URL for each

      2) Move ALL of your WordPress files to the root

      3) Login to WordPress and install the Velvet Blue URLs plugin and rewrite ALL your URLs from the old URL to the new URL. You may also have to check your Theme Options and Sliders to update links to uploaded images in those interfaces.

      So, it can be half a dozen one, six of the other. The process I’ve outlined is quick and pretty easy. Moving the whole WP install to the root requires the extra step of using the Velvet Blues Update URLs plugin and checking to be sure nothing is still linking to the subfolder URL.

      Let me know if you have any other questions, Adam! I’m happy to help clarify, and I’ll update my blog post as needed.


      • Hi! Thank you so much for your response.

        It has helped me better understand how to beautify my site’s url and the logic behind it and I am extremely grateful for your aid.

        Have a great week ahead. =D

  64. Hi,

    I have been searching on the internet to find the solution of and issue, and end up here.Hope this is the right place.

    I want to create a page inside another page subdirectory. eg:

    I have created the sports page and its url is “”.
    The problem comes when i want to create football page inside the sports page subdirectory.
    It changes the Permanent link “” to
    I tried editing the permanent link but it dont allow me.

    Pls help, i’m already behind the schedule 🙁 🙁


    • Hi Sumit,

      I think what you might want to try is to go to Pages > Add New. Create your new page called football. On that page, choose Sports as the Parent Page under Page Attributes on the right side of the screen. Please tell me if that works!


      • Hi Angela,

        Thank you for the lightning fast reply, really appreciate it.

        Coming back to the issue, i have just checked page attribute. it has only two dropdown options first is (no parent) or about page. No other option is available here at the moment.


        • Okay. Do you have a page called Sports on your site anywhere? You could create the Sports page then create the football page and choose sports as the parent?

          • Hi Angela,

            I have noticed a really strange problem here. No matter how many page i create, the Parent dropdown in page attribute shows only About page no other page is listed in dropdown. Is there any setting that i need to change. I’m new to wordpress so this might be a silly question. Can you pls help me out here.


          • Thanks.. I just figure out that cause of this problem, Actually the page were not published yet(Scheduled to be published on May). That is why they were not visible in that option.
            Have a good day 🙂

          • Yes! I really disklike that feature because I often am creating pages in advance and want to be able to choose the parent page ahead of time before I publish them all.

  65. Any problems with updating WordPress core after doing this? Everything worked well while moving to the root but now I am nervous.


  66. Hi there Angela

    This was very helpful, all worked great. However…
    When upgrading to the latest version of WP and/or the latest version of the theme we’re using, we seem to have lost the admin bar when logged in, viewing the site. Also have noticed that when I go to ‘Appearance’ and ‘Customize’, that it gives me a ‘Session has expired’ message and the log-in dialogue. In looking around, the number one solution seems to be to make sure the site address and WordPress URL are the same. However, this doesn’t help with our WP install not being in root. Would you happen to have any ideas on this problem?

    Many thanks for your great site!


    • Hi Carl,

      Yes, this is very typical, so I will add it to my FAQ.

      This is caused by an old session cookie active in your browser. Simply delete you browser cookies and clear your browser cache, then re-login to the site.

      Let me know if that fixes it!


      • Hmmm, no luck I’m afraid.

        Since first reaching out to you, I’ve tried deleting cookies and clearing the cache, different browsers, overwriting WordPress core files through FTP, and contacting the theme creators. Still no luck. It still basically is still seeing me as logged out when viewing any part of my live site, while logged in.

        I do remember this happening once before when I was developing a different site, and it was also when the site was not in root, with the ‘WordPress Address’ having the ‘/wp’ appended. The only thing I can find by searching, is people also mentioning to make sure the WordPress Address and Site Address match, which doesn’t help in this case, as our WP install is in that /wp folder on the server.

        I wonder if you might have any other clues?

        Thanks again!


        • I think there may be a typo somewhere, as I do this process on every site I’ve set up, and I’ve only seen the problem if something is incorrect some place. Here’s what I would do. This wouldn’t be related to your WP or theme install.

          Reply to me with screenshots using of:

          1 – Screenshot the contents of the index.php file in your root.
          2 – Delete the .htaccess file in your subdirectory and send a screenshot of the .htaccess file in your root (first go to Settings > Permalinks and click Save Changes).
          3 – Screenshot of your Settings > General page.

          Sometimes people put an additional . or / somewhere that can really mess things up.

        • So, when you say it’s seeing you as logged out, do you mean you can’t see the admin bar? Have you tried checking your User Settings to be sure Show Toolbar when viewing site is checked?

          • Yep, can’t see the admin bar, but also when going to ‘Appearance’ and ‘Customize’ it continuously asks me to log in and shows the WordPress login screen. (Even though I’m logged in.) Actually one other thing that happens, is that when I’m my theme options, it keeps telling me that ‘Settings have changed, you should save them’, when I’ve done nothing at all. Guess it’s all related in some way.

            That box is definitely ticked. I’ll work through the other stuff above, and get back to you soon. Everything was working perfectly til I upgraded to the latest version of WP through the WP dashboard, so I guess something could have gone awry during that process?


        • However, I do think the issue is related to a typo in your index.php file in the root (public_html) directory. I think perhaps you have /wp/wp twice and that is the problem.

          Here’s what your index.php file should look like:

          So, I am highly suspicious that this file of yours is not looking like this and you have an extra wp on the require line or some other typo. How I know this is that I know what parent theme you are using for your site as I use the same theme a lot and that if I try to go to the stylesheet for that theme, I get this error:

          • Yes, your line is not correct. It should look like this:


            The problem is with your index.php file, Carl. It should not contain the dirname in it. If it has the dirname in it, then it needs to not have the /wp/ — but you should just change it to what I sent to you. Then, delete your cache and cookies and test again.

            I do this every day, so I know 100% this is your problem.

          • Bingo!

            Just had to clear/purge my caches after the changes, and there you go. Fixed! That’s why they pay you the big bucks. 😉

            Do you know have any idea why it would have been fine until the WP upgrade? Now that it’s changed, do you think it’s likely to happen again/change back? (If it does, at least I’ll know one thing to watch out for!)

            Thanks so much, again, for your time! You’ve helped cure that major headache for us. 🙂


          • I think it was a coincidence. That extra code you had in there was causing the directory to output twice. WordPress never overwrites that file on upgrade.

  67. Hi, greate article.
    Just one problem: following this guide my website “front-end” now points to the “root” (like “”), which is fine. But the back-end still has an URL like “…”.
    Is it possible to get rid of “/test/” part of the URL?

    Thanks in advance

    • Hi Stephane, Great question. Actually, no, you will not get rid of that in the URL because WordPress is still in this subdirectory, hence WordPress and all the uploaded images and files will be referenced by way of this URL. I am fine with this and it’s totally okay for that to be the case, but if it annoys you, you can do the following:

      1 – Change your Settings > General to use the root URL for both the WordPress URL and Site URL

      2 – MOVE ALL of the files out of the subdirectory to the root directory.

      3 – Log into WordPress via the root.

      4 – Install the Velvet Blue URLs plugin and use it to rewrite all the old URLs for all the uploaded files to use the new root URL.

  68. Great article, i tried to follow your steps but got stuck at Step No. 2
    I don’t see WordPress address (URL) & Site Address (URL) blocks available under , Settings -> General.
    I have the WP-MU version 4.1.1 installed at
    And site is accessible with this url but now, i want to remove “/wp_install1” from the url for user.

    This is may be because I have WordPress multi site enabled and i need to handle step2 differently when wordpress is enable for MU/multisite. Just my guess.
    Any ideas suggestion is welcome, as i am really stuck on this issue.
    Thanks is advance for your help.

    • Hi DashDo, I don’t have instructions here for multi-site. I’m sorry. I think that is a real conundrum. As far as I know, you can’t run multisite from a subdirectory.

  69. Hi Angela-
    Does it matter that the Google-site-verification html document they have you upload to your server to verify Webmaster Tools (or is it Analytics??) still resides on the original root directory?
    I was in the File Manager tonight of a client website that I have used this subdirectory/root directory move on and noticed that. Should I move it to the subdirectory folder that WP now resides in?

    Thanks for all the effort you put into this page.

    • Hi Jennifer,

      That is a very good question. The Google Site Verification is used for Google Webmaster Tools. That needs to be in the public_html directory of the site, so, yes, move it to the root. Then, login to Google Webmaster Tools and make sure it’s working okay.

      As far as Google Analytics goes, that code usually inserted via a theme option, a Google Analytics plugin, and SEO plugin, or manually hard coded in your footer.php file. You will need to check your Google Analytics settings at Google. You can view your page source and make sure you see a code starting with UA- somewhere in your page source. Then, make sure you are still getting stats reporting for the new URLs.

      You do need to be careful with your page rank and do 301 redirects on the old pages/posts to the new ones if you did this for a site that’s been for while.

  70. Hi,

    This article helped me so much! Thank you for posting it!

    I have one thing I am unsure about, though: for security purposes – what is best: keeping the .htaccess only in the subfolder or only in the root? (or in both?)

    • Hi Ami,

      The purpose of the .htaccess file in this case is to allow Apache to rewrite the URLs. Usually this works best from the root. There are other purposes for .htaccess such as protecting directories. I teach a security class, and my experience has been that when I teach people how to modify .htaccess files to protect their website, they often end up breaking things. So, I typically recommend using a plugin like the Sucuri plugin plus their firewall service. I think that will give you the best protection in the long run.


      • Hi Angela,

        Thank you for your answer. Yes, I am considering Sucuri. But I am trying to also follow best practices with anything else I can do.

        Actually, not having a .htaccess in public_html caused errors when clicking on pages from the menu so it seems that I need one there. But, in this case, is it ok to delete the .htaccess from the subfolder? Or should I leave it there? (It seems there’s no change if I delete it.)

        • Usually .htaccess works best from the directory where the URLs are served from, in other words, the root directory. You can delete the .htaccess file in your subdirectory. Login to WordPress and go to Settings > Permalinks and click Save Changes. This will generate a new .htaccess file in the root directory.

  71. I was strugling with a WordPress installation on a Synology NAS (which doesn’t seem to be a standard WordPress environment) but this perfectly solved my problem.

    Thank you!

  72. Thanks so much for this post, I’ve completed the steps but once i log back into wordpress and make changes to the theme, css, etc. some of the ccs files associated move back to the old sub directory and stop the website from rendering properly. Do you know what could be causing this?

    • Hi Hayley,

      In this process, the WordPress files, theme files, etc., do not MOVE. They stay in the subdirectory. That’s the point. You don’t have to move the WordPress installation in order for the URLs for the pages/posts to show from the root of the site.

      The website should display fine. Do you have a URL that you can send to me?


  73. Hello,
    Thanks for your tutorial. I’ve got a onepage site and this doesnt seem to work for me. Is there anyway you could help pls?

    • Hi Kerrion,

      Yes, please let me know what your website is. Sometimes themes can cause problems if they aren’t coded correctly, but this process usually works for good themes. You might need to manually update some of the links in your one-page site navigation.


    • Hi Martin,

      I’m glad that worked! Let me know if you have any questions about anything. Hopefully, no migration will take 8-10 hours. I do know a lot of tricks for moving the WordPress install, but this process is a lot more efficient. 🙂


  74. THANK YOU FOR THIS ARTICLE!! It actually EXPLAINED things well and you pinpointed what people usually do by mistake. After about 4 attempts to follow other people’s directions, this finally made it work! Can I suggest one edit that seems like a no-brainer, but I think should be added though? You should maybe type in that they need to click “SAVE SETTINGS” after they edit the URL, and mention how to edit the already uploaded file without having to reupload it. I figured out that I had to go into my GoDaddy cPanel interface and edit it through the file manager, but not everyone will figure it out on their own. 🙂 Anyway, thanks so much again!

  75. Not exactly a question on the move topic, but about multi-site Worpress and some odd behavior and I thought you may have the answer given your background with WP. I have a multi-site setup on a deluxe server plan (working just fine until currently). The new issue is that when I try to host another WP site on the plan separate from the multi-site setup it will not let me install WP!? After searching the internet I can not find an answer to this question.

    Apologies for the derail, Angela
    Thank you

    • Hi Rick,

      Thanks for writing. I love to be derailed! I’m always up for a puzzle. Here’s what I would try:

      1) Go into your web hosting control panel and set up an add-on domain for the new WP site. It should have it’s own URL that is distinct from the URL related to your multi-site. It should get it’s own subdirectory within your public_html folder, like myawesomenewsite

      2) Instead of using one of the auto installers at your web host, manually install WordPress. To do this, download the WordPress package from Unzip it and FTP the files to the myawesomenewsite directory.

      3) In the web hosting control panel, use the Database Wizard to create a new, blank database and username. Take note of the database name, database location (usually localhost), username, and password.

      4) Rename the wp-config-sample.php file in the myawesomenewsite directory to wp-config.php and then enter the information into it from Step 3. Also, be sure to set your encryption salts.

      5) Visit and you should get the auto installer for WordPress. Then, you’ll be done.

      Let me know if this works. Steps 2-5 are documented more thoroughly at under the “famous 5-minute install”

      After doing Step 1, you will need to make sure that this domain is pointed to your hosting account, and it may take 20 minutes to 2 hours to see the DNS propagation. Contact me at my website About page if you are still stuck.

      • Angela,
        Thank you for your quick response.
        I do everything in your list except for number 1.
        I setup a sub directory, but not use a separate URL to start the auto installer.
        Not using root/myawesomenewsite to start the installer just may be the key.
        I will let you know.
        Thank you

        • Yes, I think with multi-site, basically, the main URL ends up being dedicated to the multi-site installation for the purposes of domain name management.

          So, you should register a different domain name, and add that as an “add-on” domain in its own folder, then you should be able to install WordPress to that domain.

  76. Hi Angela
    Sorry if this is a repeat question I tried to read through the blog but so many different aspect my mind boggled. 🙁
    I have used the installtron clone feature to clone my sisters site to fix the issue of subdirectory installation. My question is once you clone a site can you safely remove the original installation. Will the clone be independant of it.
    Thanks for your amazing site and your patience.

    • Hi Katrena,

      I’m not familiar with Installatron, so I can’t say how the cloning feature works. However, the two important things are that you have a full copy of the wp-content folder as well as a backup of the database. The database is NOT a file. It is on the server and requires that you export it and re-import it into a new database. If the site is going to remain on the SAME server, then what you need to do is copy the wp-config.php file from the original installation as that contains all the database settings. You may also need to go into database via phpMyAdmin.

      However, perhaps you have taken care of all this already. If the new installation is working, then you could try putting the old installation in a folder called _OLD. If the new site still works, then you don’t need that old installation any longer.

      Good Luck!

  77. Dear all,

    I have been struggling with getting the site on my domain name. It still works on I want it to work on

    If I go to the site loads:

    Settings in the SQL database are:

    Dashboard general settings:

    When I go to get this error:

    My WordPress folder is in the public_html folder, one level up there is my index.php and .htaccess, I don’t have a clue anymore. Would be very happy if somebody helps me out.

    • The index.php file and .htaccess files must be in the public_html folder. Everything else you sent looks fine. Let me know if you are still having trouble.

    • Dear Angela,
      I’m afraid I have created a huge chaos while trying to move my new site from the subdomain to the root folder 🙁 I have very (close to 0) experience in web developing, so I was trying to follow my webhoster’s instructions to the letter, but something must have gone wrong in the process..
      I had created a subdomain NEW under my Root folder, where I installed the WordPress and created a lovely new site that I was very proud about.
      This morning, again as per webhoster’s instructions, I copied the index.php file under root and changed it to (‘./new/wp-blog-header.php’)
      i was also supposed to copy across the .htaccess file, but I didn’t have it for some reason under my new site, co I created it there, copied across under root and gave it 0777 permissions.
      After that, in my new site WP dashboard, under Settings/General, I changed the address of the site, deleting the /NEW – by mistake however i deleted the /New from both lines (WordPress and Site Adress).
      And after that it’s pure chaos 🙁
      My old site isn’t working anymore (unless I restore it with the backup)
      I receive the following error message: Warning: require(/home/www/53aedd3d537f83614fabcd48dff17fef/web./new/wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/www/53aedd3d537f83614fabcd48dff17fef/web/index.php on line 17

      Fatal error: require() [function.require]: Failed opening required ‘/home/www/53aedd3d537f83614fabcd48dff17fef/web./new/wp-blog-header.php’ (include_path=’.:/opt/php/lib/php’) in /home/www/53aedd3d537f83614fabcd48dff17fef/web/index.php on line 17

      And my new site with the /new/ extension shows only a very badly formatted homepage, whereas all the links from there point to the error message above.
      I’ve tried to restore everything from backup, but unfortunately it only works for the old site, whereas I can’t get into the admin panel of the new site to change anything at all anymore.
      My webhoster wasn’t too much of help, they said basically that they are not developers and that I should solve this with a webmaster or try to find solution with the WP community. Or that I should try to have a clear install of the WP under the root, because I ‘probably installed it wrongly’. But my main worry is that – has all work that I had done on the new site disappeared now??
      Please help, you’re my last hope 🙁

  78. Hello Angela,

    My WP installation is still located in a /blog/ folder even if it does not appear in the main Url (thanks to your help last year, and to the present article).
    But my painter website is both in French and in English which is not so great for SEO, so I would like to change it into a multisite installation with the actual Url staying in English and another new domain dedicated to the French version.
    I found somewhere that for this kind of configuration the first WP installation should NOT be located in a /blog/ folder but in the root.
    Do you confirm? And in this case what should be the best solution?
    And besides, could you tell me about a simple and clear tutorial that would explain step after step how to create the multisite installation (I did not find it here)?
    Many thanks for your help!

    • Hi Hazlo,

      Here is how I have handled multi-language sites: I use a plugin called WordPress Multi-Lingual. It can be found at

      What it does is automatically create a URL for each language. I am using it at Click En Espanol in the upper-right corner of the page.

      The plugin allows you to have one WordPress installation that manages the content in multiple languages, so each page of your site will have an English and a French version. It works primarily as a content management system for your various language pages, so you have two versions of each page. You can choose which pages you want to display in French and which not.

      It does not matter if you have the WordPress install in a subdirectory, because the different translations URLs are managed via the .htaccess file. Since you would have only one install of WordPress, then it is fine.

      Please check out the plugin. It is very worth the cost! You do NOT need to create Multisite for this!!! The plugin handles the URLs without having a multi-site installation, so it is much simpler.


      • Thanks Angela for your quick reply!
        So then it is MultiLingual Plugin vs Multisite installation.
        I looked at and I could see that it works very good.
        On the other hand, the Url is getting sometimes a bit long (for instance /es/about-us-es/contacto/ ) and then I wondered about the impact it can have or not, on SEO.
        But you are right, in my case and with my limited knowledge about development, it must be a much easier way to choose the plugin way!
        I will check it.
        Thank you again.

        • Yes, the URL has one more segment for the language, but otherwise is the same as the main site. I don’t think this makes much difference between subdomains or subdirectories as with multisite, you would have to do one or the other anyway.

          But, I do think that the WPML plugin might be more SEO friendly anyway. Please read their documentation on multi-lingual SEO:

          It is helpful to use themes and plugins that work well with WPML. Most good plugin and theme developers will explicitly indicate that they work with WPML.

    • Hi Ali,

      That is unusual. What is your actual URL? Is it working, yet? You can contact your web host and find out if you have your domain name pointed correctly to their servers.

  79. Your method is genius, congrats! Here’s what happened after moving the site url.
    After login in the admin section and trying to connect to some pages or plugins I get “504 Gateway Timeout”.

    I can connect to “wp-admin” but after that, I cannot access any of the menu-> articles, pages, setting, plugins, etc.. because it takes too long…

    What can this be? What I’ve missed?

    Thank you! 🙂

    • Hi Daniel,

      Wow! I’m not sure what happened. You will still login via the subdirectory URL /wp-admin, so

      Be sure you don’t have a typo in the index.php and that your Settings > General are correct. Read the original instructions carefully and the FAQ. I think you do have a typo somewhere.

      • I’ve found out the problem. In the index.php I had an additional slash “/” before “wp-bolg-header.php”, after removing it everything works normally.

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


        • So, you usually do need a / in that line, but it needs to have the subdirectory name:

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

          • Hi Angela!

            Any idea why wordpress continues to use the links for files (pdf, jpg) without the subdirectory?



            instead of


            Thank you!

          • Because WordPress is installed in the subdirectory, it will always use the subdirectory in the URL for all uploaded files. However, pages and posts will use the root URL, because that is where we told it to show those from. But for uploaded files, if you look at your FTP directory, you will see that we did NOT MOVE WordPress at all, so, of course, those are in the subdirectory in the wp-content/uploads folder. This is correct, and you don’t have to do anything about it. Sorry for the late response.

  80. Hi, i already have an existing old site in root, and my new site is on /wordpress directory (i can’t access the wp-admin of the old site anymore, just the new one, via If i try to copy the index.php of my new site (/wordpress) to root will have any issues or conflicts between the archives? (Because on root, my old site has .htacess with permalinks structure and other archives too). Or it’s better delete my old site to move the new one to root?

    • Hi Nicolle,

      Sorry for the late response. For some reason, I am only now seeing this comment. You cannot have two sites running from the same directory. You cannot have two index.php files in the same directory, so you can’t keep your old site and new site running from the root. You would have to MOVE your old site to another directory and redo the settings and all the hyperlinks, etc. to work from another directory.

  81. Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and was hoping
    maybe you would have some experience with something
    like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.

  82. I tried this approach of moving the site into a sub-directory and I couldn’t preview any pages or posts. I got an error message “You do not have permission to preview drafts”.

    There has been much written about this (see

    Basically WordPress thinks you are not logged in because the user is logged into a WordPress installation at


    but the preview appears to be viewed at


    (these numbers will be different in your case)

    I suggest that if your host allows it, a better approach (at least the one I am now using) is to use sub-domains and map each domain or sub-domains to a directory of your choice on the server. For example -> /home/username//websites/old/working-copy-of-the-old-website

    I have also mapped -> /home/username//websites/old/working-copy-of-the-old-website

    This is so I can hide my development work from the public and the old website continues to work at the expected address. Also, there will be an archive of the old website for my customer when I am done. -> /home/username/websites/my-wordpress-directory

    Once I am ready to go public, I will re-map as follows -> /home/username/websites/my-wordpress-directory

    There is another step: I will need to update the site and home urls as already described. I have also found I need to update the links in my posts, such as links to graphics. I found this web page very helpful to do all this

    • The procedure I have written about works flawlessly and much easier, better than what you are describing using subdomains, because you don’t have to update any graphics links or other links to assets on the site.

      The reason you are getting the permissions error is that you need to clear your browser cache and re-login into the site.

    • Sorry for the delayed response. Can you give me more information about your image path and where it was original and which file is referencing it? With my process, you should need to change the path to any images uploaded via the media library.

  83. Just a little update for this procedure with a new 2014 Synology 214play NAS:

    If you’re using a purchased domain name or DDNS name, login to your NAS using this address.
    Install the MariaDB MySQL database, phpMyAdmin utility and finally WordPress in that order; installing WordPress when logged-in with your domain name will configure WordPress with the site domain name rather than an IP address.
    I received a Directory Could Not Be Created error when attempting to change the site address. I changed this using phpMyAdmin, logged-in as root. I changed the WordPressBlog table, wp_options entry to the site root address, i.e., change it from /wordpress to . This change was only picked-up when I Stopped and Started the WordPress process in the Synology Package Centre app.
    Finally you will not need to edit the line in the index.php file as this uses an absolute reference on the disk, require(‘/var/services/web/wordpress/wp-blog-header.php’);.

    Thank you for the advice here, much appreciated. 🙂

  84. I am a regular reader and have learned a lot from your most comprehensive, honest and generous articles on WordPress and related issues. Thanks a lot for all this.

  85. Hi Angela,

    I was following your steps but must have done something wrong. I could not get back into wordpress. I made it through step 1 and now when I try to access anything I just get url not found or 404 error. I cannot access the new wordpress site to change the url. Can you help? Any suggestions? Thanks! -(My new wordpress site is in a subdirectory called and I was trying to take down the old site to replace it with this one.)

    • Alicia, I wasn’t getting notifications on comments to my site for some reason, so I’m sorry for the delayed response. Did you get your issue worked out? After Step 1, you will not be able to login to your site until you proceed to the next steps.

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

      • Brilliant, yes I’m sure people will be interested in this. I read in many places that this would not work, probably used to be the case, but now it certainly does seem to work fine 🙂

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


  97. 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 🙂

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

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

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

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

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

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

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

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

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

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

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


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


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

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

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

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

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

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

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

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

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

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

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

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

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


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


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

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

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

  126. 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 🙂

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

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

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


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

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

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

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


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


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

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

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

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

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

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

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

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

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

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


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

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

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


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

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

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

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

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

  153. 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' );


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

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

  156. 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 🙂

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

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

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

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

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

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

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

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

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

  166.  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,

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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