Moving WordPress from Subdirectory to Root – FAQ

If you followed the instructions in my post “How do I move WordPress from a subdirectory to the root directory?” and you encountered any issues, please read the following list of frequently encountered issues.

Please comment below if you continue to have problems or write to me via my Contact form if you need personal assistance. If I can help you in less than 15 minutes, then I’m happy to do so for free. If the problem is more involved than that and requires me to login to your site and do the fix for you, then I charge $75/hour. Usually, I can solve these problems in less than 1/2 hour.

Verify the following:

1 – Index.php location and settings

Please check: Which index.php file did you move and where did you move it? The index.php file you moved should start with the following code:

[php]

<?php
/**
* Front to the WordPress application. This file doesn’t do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/

/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define(‘WP_USE_THEMES’, true);

/** Loads the WordPress Environment and Template */
require(‘./mywp/wp-blog-header.php’);
?>

[/php]

Check the require line in your file. Be sure that the / are in the right place and that the subdirectory name is correct. Most people make a mistake and either don’t edit the require line and put their subdirectory name in it or make a mistake with the syntax and have an extra slash, no slash, an extra period, etc.

Next, where did you put this index.php file? Some people have put it in the root of the hosting account instead of in the domain root — which is the public_html folder on most hosts. If you moved this file outside the public_html folder, that won’t work. Some people’s hosting accounts are really wildly configured, and their host does not have a straight forward path for you to figure out where the heck your domain root is. So, to keep things simple, you would have wanted to move the index.php to the directory just above your subdirectory that contains the WordPress application.

Finally, some people have inadvertently moved the index.php file in their theme’s folder rather than the index.php file in the subdirectory. If you don’t see the require line above in your index.php file, then you moved the wrong file.

2 – WordPress General Settings

The next most common mistake is to not set the General Settings in the WordPress Dashboard correctly. Here is how they should have been set:

If a mistake was made here, then you might not be able to see your site or you won’t be able to login to your site. It is pretty common to have made a mistake with these settings or forgotten to make the change here. To fix this, you will need to login to your phpMyAdmin application via your web hosting control panel. Take note of your database username and password in the wp-config.php file and check the following:

Login to the database and go to the wp_options table and click the browse tab.

The first option is is for siteurl (which is totally inconsistent with the General Settings field label). This should be set to the URL with the subdirectory:

Go to the next page of the table and check the home value. This should be the URL to the main site URL without the subdirectory name:

3 – .htaccess

Some web hosts will have issues with the .htaccess commands once your index.php file is in the public_html file. If this is the case, you should still be able to login to WordPress via the subdirectory, and your home page will display correct BUT your links to the other pages will show a “Page Not Found” error. (Please note: even though you are showing the pages of your site from the main domain url, you will still need to login via the subdirectory url – e.g. http://yoursite.com/mywp/wp-admin – and all of your images on the site will still be located in the http://yoursite.com/mywp/wp-content/uploads.)

So, if you are having troubles with your “pretty permalinks” in other words, the home page of the site displays okay, but your subpages display a File Not Found message, then login to your WordPress dashboard and go to Settings > Permalinks and click Save Changes. This should cause your .htaccess file to be updated correctly. If this does not work, you may need to move the .htaccess to the root directory and manually replace the current WordPress mod rewrite directive with the code below. (Note: you will need to show invisible files via your FTP application or use the web host’s file manager to see this file.)

[php]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
[/php]

IMPORTANT NOTE: If you are on a Windows hosting account (please check this before commenting below), you will NOT have an .htacccess file. You will need to install a web.config file to use the Microsoft’s Rewrite Module. For more information, please read: http://codex.wordpress.org/Using_Permalinks#Permalinks_without_mod_rewrite. If you are on GoDaddy and have Windows hosting, please read: http://wordpress.org/support/topic/godaddy-iis-and-removing-indexphp-in-url?replies=20#post-1507468

To determine if the permalinks is the issue with why your internal page links are displaying as Page Not Found, try to use the Default permalinks (Permalinks > Settings) and see if you can view all your interior pages fine. If you CAN view all your pages using the Default permalink settings (in other words, the pretty urls are turned off), then the issue is related to the .htaccess file on Linux/Apache hosting or not having a web.config file and rewrite rules enabled on a Windows server.

You may need to check with your web host about how to make this work properly. Some, such as Yahoo web hosting really are not good WordPress hosts, others require that /index.php be part of the permalink structure. So, if the default permalinks work, and you’ve tried creating and editing your .htaccess (Linux) or web.config file (Windows), then call your web host.

4 – PHP Version Called in the .htaccess file

One person who wrote to me had their php version command in their .htaccess file. They had deleted the .htaccess file after moving WordPress, so the PHP directive calling for the correct version of PHP was removed, and their site therefore was running PHP 4, and the latest WordPress will not run in PHP 4. This is something you can check with your web host, and they can give you the line that goes in your .htaccess file to call for the correct version of PHP. It will look something like this:

[php]

AddHandler application/x-httpd-php5s .php

[/php]

5 – Index.html and Old Site Files in the public_html Directory Interfering with New Site

Several people installed WordPress in a subdirectory because they had an existing site in the main url. When they followed these instructions to move the index.php file the WordPress subdirectory to the main site directory, they left the old site files in the main directory and therefore, the browser kept trying to open the old index.html file rather than the index.php file. To fix this, simply create a new folder called _OLD in your main directory and drag all of your old site files into this folder. Download this folder and then delete it from the server after you’ve verified that the site is functioning correctly. Do not leave these old files on the server unless you have excluded them from search engines via a robots.txt file.

Alternately, when you first purchase hosting, some hosts place an index.html file in the public_html directory as a placeholder which will definitely conflict with the WordPress index.php file. So, be sure to delete any host’s placeholder html files, such as defaut.html and index.html. Any files that have the same name as one of the URLs of your new WordPress site are going to conflict, so do some housecleaning of the public_html folder.

6 – Redirecting Old URLs

Whether you had an old .html site up or had your current WordPress site in the subdirectory indexed by Google, you’ll want to do redirects on these pages that Google may have indexed.

If you had an old .html site and the WordPress site was “private,” after you’ve completed this process, be sure to change the Privacy settings in the WordPress dashboard, so Google can now index these new WordPress urls. Install the Redirection plugin and create redirects on the old .html URLs to their new WordPress URLs. Install the Google XML Sitemap plugin and generate a new sitemap and submit it to Google Webmaster Tools. This will help prevent any 404 Page Not Found errors. Google will eventually re-index your site with the new URLs, so you shouldn’t have those old URLs come up in search engine searches after a few weeks.

If your current WordPress installation was indexed by Google with the old URLs, eg http://yoursite.com/mywp/about and now it is http://yoursite.com/about, then you will need to do the same as above for those old URLs. If you have a LOT of these old URLs, ie, you had a large, active blog before you followed these instructions, I’m testing out an .htaccess command you can use to rewrite all the URLs. I’ll post it here when I’ve tortured tested it.

7 – Protecting the WordPress Directory from Browsing

Since we removed the index.php file from the WordPress directory, now that directory can be “browsed,” which is not good. To prevent this, add the following line to your .htaccess file:

Options All -Indexes

OR create a new blank index.php file in the WordPress directory which contains the following code:

[php]

<?php
// Silence is golden.
?>

[/php]

8 – Internal Hyperlinks

Please note that this process does preserve all the image links in your site. However, you will need to reset any INTERNAL hyperlinks, including any manually entered hyperlinks in the Appearance > Menus.

Some themes have hardcoded the link to the Home page incorrect and you may need to set that correctly in the header.php file of your theme.

A good plugin for finding these broken links is the Broken Link Checker.

I have also used the Search and Replace plugin, but use it with caution, because you don’t want to replace your good image links.

Typically, I will search for <a href=”http://yoursite.com/mywp

and replace with <a href=”http://yoursite.com/mywp

then I’ll do another search to make sure I didn’t break any image links with <a href=”http://yoursite.com/wp-content

and replace with <a href=”http://yoursite.com/mywp/wp-content since the wp-content is and always will be in the mywp (aka the subdirectory).

9 – Conflicting index.html file

298 comments on “Moving WordPress from Subdirectory to Root – FAQ

  1. Hi,

    I am getting this error…

    Parse error: syntax error, unexpected ‘.’ in /home/mss247co/public_html/index.php on line 17

    What does it mean?

    • It means you have a typo in your index.php file. Check it against what I have on the post. Compare carefully!

  2. I have successfully followed your instructions. Thank you so much! My first WP website!

    My problem is that I need to point the employees to a passworded subdirectory “no_crawl” which contains various html files – the main one is kpareports.html which has links to other personnel html files.
    It is a sub-directory in the public_html directory
    I am having trouble defining the URLs to get to “public_html/no_crawl/kpareports.html”
    It should open up a password box and if correct then kpareports.html should open.
    I have moved the .htpasswd file into public_html directory.
    I get the 404 page not found error with everything I try.
    Please can you assist?

    • For some reason, I didn’t get notice about your comment on my post. I’ve been having some issues with notifications. You’d think I could figure that out 😉

      Anyway, the issue could be that WordPress is trying to parse the URL and throwing the 404 error.

      However, when it comes to personnel files, there are many security issues beyond just password protecting the folder. Even if you password protect it, passwords and user names are transmitted in the clear by the browser, and so are vulnerable to being intercepted by others. Password protecting is good to keep bots from indexing, but is not a fail safe to keep intruders out.

      I would recommend you use a third-party service to protect these files via a secure https:// login. http://box.com is a service to look into.

  3. I’ve moved the site, but the formatting appears to have broken. Some of the banner images too, have become corrupt. I was advised to create a new folder called old-site, I moved most of the old files into that, then moved my new-site into the root folder. Everything appears to have worked until I realized the formatting had corrupted. Is there a quick fix for that?

    • It sounds like actually MOVED the WordPress install. If that’s the case, then you’ll want to run the Velvet Blues URLs plugin to rewrite the URLs from the old URL to the new URL to fix the images.

  4. I have my WordPress files in a subdirectory under public folder, but it is in another subfolder as well,

    public/databases/wpnewwebsite_domain_com

    when I edit the index.php file, what would I put in this line?

    require(‘./databases/wpnewwebsite_domain_com/wp-blog-header.php’);
    or
    require(‘./databases/wp-blog-header.php’);

    thank you

    • If the website domain is pointed to the folder inside the public_html folder, then the index.php file would need to be modified to include only the folder name of the folder the wp install is inside of, and you would have this copy of the index.php file inside that first subfolder.

      I can’t quite tell from your description the path of the new site and the path of the old site and how they relate to each and the URLs you use to login to each. If you want to reply with that, I can maybe advise better.

  5. Good one Angela! I wonder if this article is up to date, and if the trick works on WordPress 4.2.2 ? Thank you!!!

    • Luiggi, this is not a WordPress-version specific “trick.” It’s the way WordPress works. This is why the General Settings contains a field for the site url and the WordPress url, because these can be two different URLs.

      • I moved my WordPress index.php and .htaccess files to public folder from a sub folder. When I go to the home url, the page displays fine. All internal webpages display fine. However, when I click back on the home page, I get the oops page not found error. I have tried to change and save permalinks, used a different theme, de-activated plugins and reactivated them, nothing seems to fix it.
        I have been trying to fix this for about a week now, if you could give me some idea of what I need to do would be greatly appreciated.

        • Hi Lucy,

          This is pretty common, and I need to make sure it’s in my FAQ. But the issue is that your Menu item is still referencing the subdirectory. Go to Appearance > Menus to fix it.

  6. Hi Maria,

    I found your blog here because I recently moved a WordPress site from a subdirectory to the root and now am getting a 500 internal server error, Trying to access the dashboard gets me a 403 Forbidden. I thought I followed the directions (https://www.inmotionhosting.com/support/edu/wordpress/329-move-folders) carefully, changing the URI and URL first then copying all my WordPress files over to the root and deleting the subdirectory. I’d love to start over from scratch, but I didn’t make backups of my files and database first. Duh. I’m not sure exactly what my .htaccess or index.php files should say, but I have a feeling it may be an issue with one of them. Not sure where to look next. Any thoughts? Thanks!

  7. Thank you for the faq, it is great! I am struggling with something. My wordpress was in subfolder, i moved it to my public root. But i now have a index.php and index.html. As you described, this won’t work. I can not delete the old folders, i am just trying to link my wordpress blog (index.php) with my dreamweaver website. (index.html) should i rename my index.html to home.html? Thank you

    • Hi Maria, I would generally encourage not having a static Dreamweaver site in addition to your WordPress site as WordPress is a better choice for all that content. I’m not sure home.html would conflict with index.php, but you might want to think about why you are keeping the DW site. I looked at your DW site, and I don’t see anything there that can’t be added to WordPress pages. So, I would encourage you to do that. Though, yes, if you don’t use index.html, you can rename your DW home page to something else. Keep in mind, however, that when people visit your site, they will go DIRECTLY to the WordPress site. You can’t avoid that if you want WP to show from the root. Again, I would copy all your DW interior page content to WP and just use WP.

  8. So I followed the steps you had laid out, but I am getting this error…

    Fatal error: require() [function.require]: Failed opening required ‘/data/17/1/61/1/1224001/user/1305126/htdocs./wp1/wp-blog-header.php’ (include_path=’.:/usr/share/php:/usr/services/vux/lib/php’) in /data/17/1/61/1/1224001/user/1305126/htdocs/index.php on line 17

    Here is the code I have in the index.php…
    require( dirname( __FILE__ ) . ‘./wp1/wp-blog-header.php’ );

    Everything else seemed to go as you have written except this step. Any ideas?
    Thanks

    • Hi Steve,

      You have two periods in your require line:

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

      should be

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

      Make sure you are using straight quotes and not curly quotes.

      ~Angela

  9. In that case, what should how should create robots.txt file ?
    Will it be
    disallow:/Wp-admin
    or
    disallow:/(“directory, where wordpress uploaded”)/wp-admin

    Please sir i am waiting for your answer

  10. I promoted dev.rosiepope.com to rosiepope.com using your method. Your description of seeing the home page but experiencing broken links led me to notice I had dropped the leading “.” from .htaccess. Once restored, things looked better.

    Then, I noticed some theme icons for menus, dropdowns, and page scroll-ups were missing. Using the browser’s inspect element display, could see a problem with cross-domain access to theme content located in the sub-directory.

    Assuming the use of an Apache web server, putting an .htaccess file with a Header set Access-Control-Allow-Credentials directive allowing access to the domain in the root will fix this problem. Put the .htaccess file in the directory that has the content you wish to make available.

    • Hi Stuart,

      The method I outlined does NOT work with subdomains. Only subdirectory installs. If the site is located in a subdomain, you have change your General Settings to use the root URL and then move the entire WP install out of the folder you have it in which is associated with the subdomain and put it in the root, aka, public_html directory and then using Velvet Blues URLs plugin to rewrite your URLs.

      • I migrated the entire site to the root directory and used velvet blues. Now, things are looking fine. However, a sub-domain is, at heart, a sub-directory. Before I moved the entire site to public_html, I noticed that some browsers, like Chrome, would hang up and have slow page loads, reporting a “tainted canvas” and other anomalies, despite authorization settings. GTMetrix also reported some very slow load times (e.g. 66-71 sec,) when 2-3 sec should have been the norm. So, my question is, why does your simple migration method work well for sub-direct ories, but not for sub-domains?

        • The reason that my process works for subdirectories is because the primary domain is pointed to the public_html directory. When the site is installed in a subdirectory, it is still using the primary domain which is pointed to the public_html directory, and WordPress is in the subdirectory, so the site is viewable as:

          askwpgirl.com/wordpress/ for example

          Then, when we use my process, WordPress and all the uploaded content is STILL located and accessible via the subdirectory. So your image URLS, etc. ALL still use the subdirectory for their URLs. The ONLY thing that has changed is that the permalink structure for the posts and pages which can be served from the root by simply telling WordPress: hey, I am showing my site in the root, but my WordPress application and uploaded content is in this subdirectory.

          The reason this does not work with subdomain installs is that you would have to rewrite ALL the URLs! The whole purpose of the subdirectory install is that you don’t have to rewrite the URLs. The ONLY reason to install in a subdirectory and serve from the root is the convenience of not having to MOVE WordPress and rewrite all the URLs. If you are going to rewrite all the URLs anyway, then it is the same as migrating the site. With my process, we are not migrating the site. We are simply modifying how WP treats the permalinks to the posts, pages, etc.

          With a subdomain, all your URLs are wordpress.askwpgirl.com for example. You don’t want your WordPress installation and uploaded files to be referenced to a DOMAIN OTHER THAN YOUR PRIMARY DOMAIN. It would create some very weird behavior. A subdomain is a DOMAIN of sorts. It is not a subdirectory. A subdirectory is a location. A subdomain is reference to your website as its own entity. Just like how mixing your www and no-www is confusing to services and crawlers, etc. www and non-www are each their own domain reference. You don’t want to intermingle them.

          What is confusing to people is that their subdomain is pointed to a subdirectory on the server.

          If you want to keep your WP install in that subdirectory that the subdomain is currently pointed to, you need to FIRST change the general settings in WordPress to use that subdirectory rather than the subdomain (e.g. use http://askwpgirl.com/wordpress rather than http://wordpress.askwpgirl.com). Then, use Velvet Blues to rewrite the URLs form wordpress.askwpgirl.com to askwpgirl.com/wordpress. Make sure you can see the site okay via that new URL, then you can follow my process. Also, delete your subdomain in the web hosting control panel (but keep the files) so you don’t get docked for duplicate content.

  11. Dear Angela,

    Elegant Themes suggested using your method for our new site, which is installed in the default wpinstall directory.

    However, our original index.php format is different from your example.

    Yours:

    require(‘./wp-blog-header.php’); ?>

    Ours:

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

    How would we add wpinstall?

    Thanks,

    Colin

    • Yes, yours is correct! My code is from older versions of WordPress.

      So, yours would need to be edited to show ./wpinstall/wp-blog-header.php

      • Thanks Angela,

        So our version would be like this – with the dot still outside the quote mark?

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

        or this – with the dot moved inside the quote mark?

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

        We have tried both and neither seems to work.

        What else should we look at?

        We have a multisite installation.

        Also, could the .htaccess file be an issue?

        Best,

        Colin

        • The dot is a concatenation operator in PHP. It is joining two pieces of code:

          require( dirname( __FILE__ )

          AND the text string:

          ‘/wp-blog-header.php’

          So, to work, it does need to be outside of the quote.

          It’s possible your problem is that you might have curly quotes instead of straight quotes for your ‘ ‘ around the /wpisntall/wp-blog-header.php string. What text editor are you using?

  12. Hi,
    I have followed your instructions and am getting a blank screen. Can’t work out where I’ve gone wrong. I have copied & changed the index.php file. The site comes up still when I type in the sub domain address but not the main address. Are you able to have a quick look at it for me?

    Site is: acu-power.com.au
    I have the WordPress site at: acu-power.com.au/site
    Admin is at: acu-power.com.au/site/wp-admin

    Do you need ftp login details?

    Kind Regards,
    Sara

  13. Hey Angela!

    I was reading through the comments but could not find an answer to my problem.
    After successfully changing my site address and coping the .htaccess and index.php into my root folder something weird happened to the way some of my links and parallax backgrounds look.
    I’m not sure if this has something to with the way my theme sets up the options and I’ve looked everywhere. I would greatly appreciate your help.

    Here are a coupe examples of what the links and backgrounds looked like before the move:
    https://www.dropbox.com/s/6f90vifoel1yyn2/2014-09-14%2002.46.17.png?dl=0
    https://www.dropbox.com/s/5m09rc7d8gc8vwm/2014-09-14%2002.46.23.png?dl=0
    https://www.dropbox.com/s/63gbh5pjx0he44d/2014-09-14%2002.51.22.png?dl=0

    Any insight you might have will be extremely helpful!

    • Hi Edgar,

      I’m sorry I didn’t respond to your comment on my site sooner. I was getting a lot of spam comments for awhile, and your comment got buried.

      Were you able to figure out the problem with your Parallax scroll after the subdomain move?

      My big issue with themes in relation to WordPress location is that some theme developers use the wrong URL for referencing the themes folder or the uploads folder. It’s just a sample of bad practice with coding, but usually can be resolved by modifying their PHP to use the correct location for the folder.

      Let me know if you solved your problem or not.

      Thanks,

      Angela

    • The front page is showing up now, so I wonder if you fixed it? If the wp-admin is in the root, it sounds like maybe you MOVED the WordPress install the root rather than doing the process described in my post which involves only moving the index.php file. If you move the entire install to the root directory, then my post is not applicable. Let me know how things are.

  14. Hi Thanks for you help , it finaly works i have mydomain .com instead of mydomain.com/wp/.
    BUT I have now a new problem :
    Error establishing a database connection
    I added url in config.php
    Change phpAdmin because General setting is not showing me url option at all??
    but now data conection probleme
    I might have done something when i clean up the old web site (no wp) .
    Thwe 2 website were runing under public folder ,One in the root and wp in subf.olde.
    I dont know what to do now .
    Hope you can guide me a little here /
    Merci
    Claude

    • Hi Claude,

      If you already had a site in the root, then you can’t have the one in the subfolder also display from the root.

      The settings for the General Settings are in the wp_options table in phpMyAdmin.

      Let me know where you are with this. You can contact me via my About page and then I can reply, and you can send me screenshots.

  15. Hi……My Problem is when i am trying to come back from header.php included file’s links from directory then its is showing directory’s link….like http://www.vpsbhaba.com/admin/view/dashboard.php..and getting url not found error…the actual link must be like this ……http://www.vpsbhaba.com/admin/dashboard.php…because the my dashboard.php file is in the root admin directory……so any one plz help me to sort this problem..how i can fix this link as permanent when i move to sub directories pages….

    Thxxxx

    • Hi Raj,

      The URLs you are referencing are not WordPress URLs, so I do not know how to advise you. I think perhaps you are using a different software that is not WordPress?

  16. After adding signup and login page to my wordpress template, everything works smoothly except that each time visitor click on any hyperlink menu, it takes them back to home page. it is not displaying the right page for the hyperlink. Any help?

    • Hi Falade,

      Sorry for my late response. I have been out of town. Can you check the links for your navigation under Appearance > Menus? Also, can you send me a URL to your website? Thanks!

  17. I moved my blog to root by 1) changing the site and wordpress urls to the root in Settings > General then 2) copying the entire contents of my former wordpress folder to the root. The site works ok except that preview (themes or posts) doesn’t work and the blog front page (which i’d like to contain recent posts) is lost. I suspect some of this has to do with conflict between index.html for my main site and index.php for the blog both residing in the same place.

    This has been a while, so I may be further complicated by updates and other changes.

    Where would you start?

    • Hi Scott, I’m sorry for the late response. I imagine you’ve solved this problem. I was out most of the month of August, and I am just getting back to my blog.

      The preview issue is usually related to a browser cache problem, so completely clearing your browser cache will solve that issue.

      And, yes, you don’t want to have both index.html and index.php in the same directory, so delete the index.html.

      Howe else is it going with the transition? The Velvet Blues Update URLs plugin will help with any broken image links after doing the process you did since you moved all the files to the root. https://wordpress.org/plugins/velvet-blues-update-urls/

      • Thank you for your suggestions! I’ll see about image links. Otherwise, i still have the same issues.

        I have a web site built with DreamWeaver and a WordPress blog installed in a WordPress folder but operating from the root. Thus the WordPress index.php and index.html (my site’s home page) would both reside in the root folder, except that the site’s home page is also php. To get around this i put a 301 redirect in .htaccess of index.html to another page that is now my site’s home page. My server picks index.html ahead of index.php, so all appear to work OK except for Theme Preview and the link to the WordPress Front Page, which i would like to show all recent posts.

        I don’t think the index.html vs index.php is an issue. Even so, i unsuccessfully tried to incorporate the WordPress index.php in my site’s index.php. Is there a way to do this? That would certainly be more elegant! Also, what IS the link to the WordPress front page? Many Thanks!!

        • Hi Scott,

          You cannot and should not have index.html and index.php in the same folder.

          You will need to delete your browser cache to get the preview to work again.

          I’m not sure what you are asking about the “link to the WordPress front page”? The front page of the site is the URL of the website. e.g. http://water-law.com. This is what your HOME button should go to in your menu (Appearance > Menus). If you are talking about Settings > Reading, then the Front Page is the page that is the site URL (same as above) http://water-law.com, and the Default Posts page is the default blog page which shows all recent posts. By default, your recent post are on the front page (http://water-law.com) unless you change the settings. People change the readings settings if they do NOT want their recent posts on the front page.

          So, the problem and confusion for you is that you want TWO ROOT SITES: the DW site and the WP site, which is not possible and is why you are having issues with getting your the default recent posts to display, because WP wants this to be the http://water-law.com page, and it can’t because that is the DW page.

          You could create a new page on the WP site and call it Blog, then in the Settings > Reading, leave front page unselected and Posts page set to blog.

          How I would handle this is to create a WP template that only included the DW code and then assign that template to a page called Home and then set that as the Front Page of the site in the Reading Settings. This would resolve all the issues, and you wouldn’t need the index.htm file nor the redirect, both of which are mucking things up a bit. Let me know if you want help with that. :-)

        • Hi Scott, I wrote you an email, but I’ll post this here so it might help others:

          1 – Create a new php file called template-dwhome.php

          2 – At the top of the file put this code:

          < ?php
          /*
          Template Name: DreamWeaver Home Page
          */
          ?>


          Below this PHP code copy and paste the contents of your index.html file.
          Rename your index.html file to index.html-bk and rename the redirect file you created as well.

          3 – Upload this file to your theme’s folder.

          4 – Create a new page in WP called “home” or “DW Home” whatever you want. Also create a page called Blog. On the home page, choose the template you created above from the Page Template Select list on the right side of the edit page.

          5 – In Settings > Reading, choose the Home page created above as your Front Page, and the Blog page as your default posts page.

          6 – Now, on your DW site, you should like to http://water-law.com/blog for the blog instead of the archive as you’ve been doing.

      • Thank you so much for mentioning that preview problems after moving blog url to root is just a caching problem! I spent a ton of time going down a rabbithole of .htaccess and mod_rewrite stuff before seeing this, and clearing my cache totally solved it! >_< Thanks!

  18. Hi Angela,

    I having trouble with my site after using your ‘Moving WordPress from Subdirectory to Root’ article. I just wanted to say that everything has moved smoothly except the Homepage for some reason. All the internal pages work I have tried switching different pages set to the homepage and it seems to only effect the page set as the home. Please I need your help.

    –if you add /about-us to the site you can see that it is working perfectly.

    • Hi Joshua, Yes, this is common. It is caused by a hard-coded menu link to the home page. You can fix this by going to Appearance > Menus and modifying the home link. Let me know if that solves your problem. Sorry for the very late response. I’ve been away most of August.

  19. Hello! Firstly, great site, nice tutorials! Im trying to move my site from a subdirectory to appear at the root and have followed all the steps outlined in your post several times. And have gone through everything on the FAQ page too. Firstly I was getting the white screen of death only on the homepage but with subsequent attempts I am now getting that on all pages of the website. I am still able to log into the manager thankfully! I have another site on the same host so I know its not a hosting issue but I’m a bit stuck on what else I could try? I’ve recopied and pasted the index.php and .htaccess at the site root from my working site even but the issue still there! Any ideas?

    • Hi Naomi, First, let me apologize for my very late response. I have been away for the past month. The problem can be a theme or plugin that doesn’t like the fact that the site is still in the subdirectory but showing from the root. So, you can try de-activating all your plugins.

      Another thing to try, and this I’ve seen work for your problem, is to login to WordPress, and then activate one of the TwentySomething themes and then re-activate your theme. I’ve definitely seen on rare occasion a theme sort of get confused, and de-activating and re-activating it has solved the problem.

      Lastly, if the above doesn’t bring back the site, edit your wp-config.php file and change the line that says debug to true. This will show an error on the white screen instead of just the white screen and can help point you to the problem. Be sure to set this line back to false after you’ve fixed the problem. You should also have an error log if you login via FTP to the site. It will be either in the root folder or the theme’s folder, so that can be helpful to see where the problem is coming from.

  20. Hi Angela,
    I need your help. I had my site in a directory /test/ when I went to go live I moved it to the root directory before I changed the url in the admin.

    I tried to move the files back to the test directory so that I could login and the site broke. I can not login and it currently saying “Fatal error: Call to undefined function nocache_headers() in /home/creatin1/public_html/test/wp-admin/admin.php on line 32.”

    This is so urgent, your help would be much appreciate.
    Thank you

    • i had that problem, what happened is that you didnt create a user for the database, or you input a wrong user name or password inyour WP-config file

      • Good point! Hopefully during this process, the person didn’t change anything in their wp-config.php file. Usually, it’s a typo in the index.php file or in the General Settings.

  21. I’ve followed your procedure for keeping a wordpress site in its subdirectory and then pointing the index.php file on the root to it. I’ve done this a dozen times, no problem.

    Today I tried to do it and something didn’t work out. Still got the internal error message even after checking and rechecking the index.php file.

    I went ahead and put the old static site back on, took the index.php off the root. I went to the WP database through phpmyadmin and changed the home url back to the subdirectory url (the same as the site url) even though I had done it correctly the first time.

    I decided to make another fresh installation of WP at the same server so I could move the database into it if needed. I wasn’t able to set up the new one. I got a “The MySQL Connection could not be established.The MySQL Connection could not be established.” message.

    I have written the hosting company, Lunarpages, about this but haven’t heard back yet. I still see that the WP subdirectory (the one I want to make live) is still there on the server and all the posts are in the database…

    The website is http://chathamcountytogether.org (back to its original traditional website). The subdirectory is cischatham14, so should be viewable at http://chathamcountytogether.org/cischatham14/, but I can’t even get into the backend right now.

    Got any ideas of where I am on this now? Thanks Susan

    • Usually, when something doesn’t work, I have addressed this in my FAQ. You might follow the original post first step-by-step: askwpgirl.com/how-do-i-move-wordpress-from-a-subdirectory-to-the-root-directory/

      99% of the time it’s a typo.

      If you had an existing site, you would need to make sure that site’s index.html was not in the root directory or renamed, so it doesn’t conflict with the WordPress index.php file.

      As for your “fresh” installation, if you just copied your old install, you would need to edit the wp-config.php file to work with the new database you created to go with that fresh installation. See http://codex.wordpress.org/Installing_WordPress

  22. This site has been very helpful however I have an issue that I have not yet seen posted. I moved my index.php and .htaccess file to my root and everything appears to be working fine. I only had 7 posts created when I moved over to the root, but now none of the comment sections work. When users try and leave a comment they are getting a 404, but if I include the subdirectory in the page where I’m posting the comment from it works. I’ve checked for broken links and I don’f have any. If I change my site url back to http://sitename.com/wordpress everything works fine, but if I have http://sitename.com my comment section stops working. Everything else seems to work fine.

    • Hi Sharon,

      That is very curious, and I’m suspecting it is a problem with your theme, and that the theme is badly coded and references the WordPress Site Address instead of the WordPress Address. These are two different code snippets, and I imagine if I looked at your theme, I’d see the comments coding using the wrong code snippet. I have never had issues with any site with this process, and since comments are controlled by your theme (or comments plugin), the issue would be with the theme (or comments plugin).

  23. I used your tutorial to move my wordpress to a subdirectory and everything worked great for a long time. Two days ago I moved my site to a different host. Went from networksolutions to bluehost. I think I moved everything properly. I am having issues now. All of my internal pages and wordpress admin pages function perfectly, the only problem is my homepage will not load, i get “The page isn’t redirecting properly”. Any tips? My website is logsplitters.com

  24. I have one more question! I found another blog post by smashing magazine http://wp.smashingmagazine.com/2013/04/08/moving-wordpress-website/ and in the section on moving a website from a subdirectory to the root, they suggest (in step 2) to turn off pretty permalinks before you change your website address URL.

    In your article, and the directions from wordpress codex – http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory#Using_a_pre-existing_subdirectory_install it doesn’t mention that you need to turn your pretty permalinks off first.

    Do you have any thoughts on why you would or wouldn’t need to turn them off before you start the switch?

    Thanks!

    • What I have had to sometimes do is to click Save Changes on the Permalinks page after making the move. The only reason I can see for using the default permalinks before making the change is to force the .htaccess file to be cleared, and then after making the change for it to be rewritten. It is always re-written when you click Save Changes, but sometimes you will end up with duplicate files — one in the root and one in the subdirectory. And, ideally, you only want the one in the root.

      • I did turn the permalinks back to default before I made the switch and re-turned them on afterwards. It went really smooth! And of course just had the one htaccess file in the root :) Thanks for explaining the reasoning behind it, it all makes sense now!

  25. Hello :)
    I have made quite a few wordpress website and have always been successful in moving them from subdirectory to root. But now I have a major issue with one of my websites.

    I followed the normal procedure, changed the URL in settings, copied the htaccess and index files to root, changed the subdirectory name and saved.

    But when I went to my site, I was greeted with the white screen of death… Where did I go wrong and how can I fix it? Thank you in advance :)

    Kathrine

    • Hi Kathrine,

      That really sucks! Are you able to login to your WordPress Dashboard? If so, I would recommend selecting the default 2012 or 2013 theme and see if the site comes back. If it does, then it’s an issue with your theme. You can also try troubleshooting your plugins by renaming your plugins folder to plugins-old, logging into the WP dashboard and then visiting the plugin page which will force all the plugins to be de-activated. Then, rename the plugins folder back to plugins and reactivate them one at a time.

      However, more likely, the problem is a typo in your index.php file. Any luck yet?

  26. Hi there,
    I am getting ready to replace an existing html site (at the root) with the new wp website I have been developing in a /preview sub directory. I am going to use the method you outline in your post.

    On the wordpress codex page about Giving WordPress its own Directory: Using a pre-existing subdirectory install – (http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory#Using_a_pre-existing_subdirectory_install ) it says at the bottom “If you already have content in your site, see when your domain name or URLs change for how to deal with references to the old URL that will remain in the database”

    When I read your post as well as the FAQs on it, I didn’t see any mention about having to do any ‘search and replace’ on the database to update URLs. Is that because your instructions should be done before adding content to the site? Or will following your instructions take care of this issue so that you don’t need to do a ‘search and replace’ on the db?

    Thanks

    • If you have had the site up for a long time, I do address this in my posts. 1) All your posts and pages will have new URLs that don’t have the subdirectory in them, so you would need to use a plugin like the Redirection plugin to do 301 redirects from the old URL to the new URL. 2) If you have internal hyperlinks to specific pages and posts on your site, then, those links will need to be updated.

      I do NOT recommend using a search and replace for the old url to the new url because that will break ALL of your images and uploaded file links. Remember, your WP install is still in the subdirectory, so links to images and uploaded files will still be in the subdirectory, and you don’t want to change the URLs to those. They will remain the same as before.

      • Hi Angela, after I sent this post I realized you did address this in number 8 – internal hyperlinks, sorry I missed that! Thank you for the advice on not using the search and replace. I’ll use the broken link checker and fix all the internal hyperlinks manually!

        I had the subdirectory WP site set to not allow search engines to index, so when I make the switch today I’ll allow it to be indexed and should then just have to do redirects from the old html site URLS to the new WP site URLs. plus will use that xml sitemap creator to submit to google webmasters.

        Thanks so much for your response! And your articles are very helpful and informative :)

        • You are welcome! Be sure to remove all those old HTML files from the server. Download them so you have a backup, then delete them. Good luck!

          • I followed your instructions to the T and it went incredibly smooth, including the backup, clearing out the old html site from the server, etc! Your post and this FAQ page are bookmarked for future use. Thanks for all the work you did putting this together and providing support to your readership :)

          • Yay! In the tech world and WordPress community, there tends to be a lot of advice that is just overblown, overly complicated, or just plain silly, particularly when it comes to certain processes and security. The tech geeks dominate with all sorts of ineffective methods and advice. I hope I can make things simpler.

  27. Hello, your website has been very helpful getting started with WordPress and I was just able to convert my website over to WordPress and publish it. My installation was in a subdirectory as mentioned in your how-to article but I found a different method that worked well and you may want to try it. Instead of altering any of the sites configuration of PHP code I just created an index.html file for the root with a re-direct to the Workpress site as it is in the subdirectory. A great example can be found here:

    http://stackoverflow.com/questions/5411538/how-to-redirect-from-an-html-page

    Just take out the http://example.com and replace it with your full url to the wordpress site like http://yourdomain.com/site/ and drop it in the root of the web server as a file named index.html. You can also drop it in any of the uploaded content directories to automatically direct people to your home page and prevent them from browsing your content.

    • Why would you do this? It doesn’t make any sense, since all your URLs will still have the subdirectory in them.

  28. Hey guys, so I was developing my wordpress site in a subdirectory … now that i’ve changed it to the regular url my login/logout links don’t redirect properly – they redirect to the url/subdirectory.

    So for example, i was developing in mysite.com/subdirectory

    Now i’ve changed it to mysite.com, but the site is still in /subdirectory – everything works as I have moved the index.php and changed the url and whatnot, but the only thing that does not work properly is the logout feature.

    So when I click logout, it redirects me to mysite.com/subdirectory/, not to mysite.com – which obviously is a 404 page now that I have changed the home url to mysite.com

    I cannot seem to figure it out. :/

    • WordPress is still installed in the subdirectory. Using this process, we do not move WordPress. We simply make the pages and posts display from the root. So, yes, you will still login via the subdirectory URL, and all your images and uploaded files will still have the subdirectory in their URL. Nothing to fix. What you are seeing is to be expected. If you never ever want to see the subdirectory again, you would need to MIGRATE the site to the ROOT (literally MOVE WP) which would result in all your image links, etc, breaking. You can do that and then use a search and replace using the Velvet Blue URLs plugin to fix those. WordPress.org has a good article on moving WordPress.

  29. Hey! I am trying to get my blog to show up in my root directory using your directions, but when I add the /directory command to my index.php file, I get the following error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE (it says it’s on line 17 of my index.php file, which is a blank line when I count the lines in my index file. I made sure that there were no blank spaces or extra periods or slashes. Any idea what I might be doing wrong? I copied both my .htaccess and index.php files to the root directory, leaving the originals in the subdirectory. Any advice for fixing this error would be greatly appreciated. Thanks!

    • Yes, I think you just have a typo on that line. It is very common for people to have a typo. So, be sure to check this:

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

      Substitute the word “subdirectory” with whatever the name of your subdirectory is. I think that should be the problem because if you did something else wrong, it wouldn’t give you the specific error about that line#. Most often, I see that people forgot the ‘ or the leading / or remove a space — just some sort of typo. You can email me the file if you want to angela@_________.

      Angela

      • Hi Angela. I emailed the file to you, but I didn’t hear back, so maybe you didn’t get it. Anyway, I eventually figured out what the problem was. I am not sure why, but one of my apostrophes became a curved quotation mark. I found a straight apostrophe on the WP Codex site to copy and paste, and that fixed the problem. Now I have one other question for you. After I got everything working, when I went to my old url, an old post was showing up by default, so I changed the index file to the silence is golden code, and that fixed that. Now my question is, do I need to leave the old .htaccess file in the subdirectory, or can I delete it? I noticed that another user was having trouble viewing her preview and you mentioned the .htaccess file in your response. When I posted last night, I was unable to see my preview until after I published my post, so I wonder if it’s because of that.

        • Hi Tammy,

          That makes sense. If you edited the index.php file in any type of word processing document, it would insert a curly quote instead of a straight quote. An HTML editing application (of which there are many free versions) would not do that.

          You can delete the old .htaccess in the subdirectory and just leave the one at the root directory.

          As for the preview not displaying, that could be effected by the old .htaccess. You might also want to delete your browser cache and go to Settings > Permalinks and click Save Changes to be sure your .htaccess file is updated properly.

          I didn’t receive your email. Sorry.

          Angela

          • Thank you for all of your help, Angela! I edited my file through Firezilla–I just right-clicked on the file and selected the edit option and then saved and reuploaded it. I will look for an editing application for future use. Sorry you didn’t get my email. I probably typed that wrong, too, lol. I’m glad I found your site–thank you for your willingness to help one-on-one. You are awesome!

          • Hi Tammy, Funny that Filezilla made the curly quote. I know that sometimes coding things can be silly little things like this. It’s enough to make you want to pull your hair out. I’m glad you figured it out!

  30. Hi Angela,

    Your instructions are well written and I thank YOU so very much for them. However, I am experiencing a major issue. I have moved a copy of wordpress website from the sub-directory “blog” folder to the root. Am able to login perfectly, and have made all the changes you suggested and all is well… except, I cannot view any of the pages or posts.

    From the Edit Post view of any post, when I click on View Posts button I receive a “404 Page Not Found” error page, and when on the Edit Page view of and of and Page, when I click on View Page my browser displays the loading index.html file that is keeping the website LIVE.

    The index.HTML page is the loading page that is located in the root, and I do not wish to have the site shutdown. After moving the copy of all the WordPress files to the root, I renamed the index.php to indexOLD.php, and the website is still accessible to visitors.

    How can I view any changes I wish to make if I cannot view the pages and posts?

    Will I need to shutdown the entire website in order to do the necessary changes?

    Hope you can respond quickly as I do not have 5 days to wait. Need to do this job a.s.a.p. Had not idea it would be so difficult.

    Thank YOU in advance for ANY help you can offer me.

    • Hi Trish,

      When you say “move,” do you mean that you followed my instructions or that you physically moved ALL of the WP files to the root directory? These are two different things. If you followed my instructions or not, you can NOT have the index.html file in the root. That will mess everything up and cause errors.

      So, rename the index.html file to index.html.bak. Then, login to WP and go to Settings > Permalinks and click Save Changes. You may need to delete your old .htaccess file and have it regenerated via the resaving of the permalinks settings. This is 99% of the problem (plus needing to get rid of the index.html file which is only going wreck your site).

      Finally, be sure you are not using a caching plugin, and if you are delete the cache entirely and resave the caching plugin’s settings, so it writes a newly updated .htaccess directive as well.

      Email me via my contact form if you continue to be stuck. It will be one or all of these three things.

      • Hi Angela,

        Silly me, I was hoping I could save a step or two (daaah!) and made a copy of the wp files and placed them in the root directory… renaming the index.php to indexOLD.php so it would not interfere with the website staying live. Hey, had to experiment and now I know. I cannot work on the new site within the root directory .

        When I didn’t hear back from you as quickly as I had hope to, I decided to experiment… realized my error and created a “blog1″ folder in which I am now creating the NEW website pages inside of.

        Have even decided to go with creating a new Responsive HTML loading page rather than use your suggestion for copying the index.php file to the root domain. Don’t get me wrong, I DO like your idea, however, the theme I’m using does NOT allow me the ability of creating MY preferred style of loading page.

        Am VERY thankful you have this post and hope you will make sure to leave it as long as the info remains relevant. Your attention to detail is exceptional and I certainly appreciated finding it.

        Thanks again,
        Trish

  31. I’m moving from folder to folder so like mysite.com/oldblog/ to mysite.com/newblog/
    It works but all the old links are broken.
    You mention working on a fix for this?
    I have tried several .htaccess files only to get infinite loops on the error404.

    -“If your current WordPress installation was indexed by Google with the old URLs, eg http://yoursite.com/mywp/about and now it is http://yoursite.com/about, then you will need to do the same as above for those old URLs. If you have a LOT of these old URLs, ie, you had a large, active blog before you followed these instructions, I’m testing out an .htaccess command you can use to rewrite all the URLs. I’ll post it here when I’ve tortured tested it.”-

    • Any wildcard .htaccess redirects will not work, because the wp-admin and wp-content folders are located within the subdirectory.

      You have two choices:

      1 – add the old subdirectory slug to the Permalink structure:

      Choose Settings > Permalinks and check Custom and type:

      /oldblog/%postname%/

      All of the pages of your site will still show from the root but your blog posts will maintain their old URL structure. If that’s acceptable to you, that might be a good solution.

      2 – the other choice is to actually MOVE WordPress to the root directory. However, this requires running a Search and Replace plugin to replace all the old image URLs to the root directory, e.g. /oldblog/wp-content/ to /wp-content/

      I’m not an expert in .htaccess, but you should be able to find something online to do a redirect then for the subdirectory for the root. Here’s info at WordPress.org if you decide to move the entire install:

      http://codex.wordpress.org/Moving_WordPress

      I often do this, because then you can do the wild card redirect in the .htaccess file, since nothing will be referencing that subdirectory any longer

      • After nearly a day of reading articles on how to move from /dir/ to /root and getting nowhere I finally figured it out.
        I read enough .htaccess hacks and tried them all to fail.
        THEN I realized I am changing the .htaccess in my /new-blog/ folder but the request are going to my /old-blog/ folder where there is not even a folder anymore producing a 404.

        So instead of in my WP .htaccess, I took it back to the /root where I have my static HTML files, CSS and of course my main sites .htaccess file.
        Made a quick edit in THAT .htaccess file and walla.
        Anyone going to http://stickystatic.com/myipaddressdns/ will auto get redirected to http://stickystatic.com/tech/
        No matter what post ID, slug, name, title are attached after it will be /tech/post-name/ too.

        • Yes, having two .htaccess files can mess things up. .htaccess works from top down, so you only need one in the .htaccess folder. But, it sounds like you were moving the WP site from one folder to another folder rather than from subdirectory to root.

  32. Hi! It seems you are very helpful with wordpress! I need help! I want to be able to go to my homepage when I type in my domain name. It still goes to the namecheap parking page. BUT when I type in http://www.hourafterour.com/home, I get directed to my website without errors. And I can even go to the other pages and everything works fine. So the issue is that I cannot arrive at my webpage from the actual domain name. Can you please help?!

    Thanks,
    Steph

  33. I’ve done everything in terms of having the root of my website display the /wordpress/ install fine…but the wp-admin tool bars no longer show at the top of my pages, which makes for inconvenience when flipping between editing and viewing. Any ideas?

    • Hi Karen,

      This is a common problem and can be fixed by clearning your browser cache. If you had a caching plugin installed and activated, also please clear your cache for the plugin. This will fix the problem. As a tip, when I work with WordPress, I keep one window open to the Dashboard and one window open to the live site. Good luck!

  34. First of all thanks for tutorial but after applying all asked steps. I am getting down below error;

    Index of /blog
    Parent Directory
    license.txt
    readme.html
    robots.txt

    Please let me know where i am going wrong.

    Thanks in advance
    Anil

    • Hi Anil,

      I sent you an email response, but for the readers of this blog, you will want to have a COPY of the index.php file you moved present in the /blog folder. Usually, I suggest people copy this file instead of move it. Or, you can create a blank index.php file in this folder with the following code:

      < ?php
      // Silence is golden.
      ?>
      

      This will prevent the subdirectory folder where WordPress is installed from being indexed and viewable to the public.

  35. I’ve been struggling with this seemingly simple task for days. My site is viewable using cathedralcarejax.org, and WordPress resides within a subfolder also called cathedralcarejax.

    Changing the site URL setting from the unwieldy temp url — “http://69.195.124.93/~catheds8/cathedralcarejax/” using the prescribed method will display the header OK, but results in 404 errors on all pages. This is after following your instructions to the letter and resaving the permalinks.

    I have no doubt I’m overlooking something very obvious, but after three days I can’t see what it is. Your instructions seem simple enough, and WordPress’ instructions for changing the url seem simple enough too. But the site only seems to function if the stupid Bluehost temporary URL stays in place.

    Any insight come immediately to mind? At this point I’m willing to pay for a solution.

    • Hi Dave,

      Yes, I understand your problem. You have your nameservers for the domain pointed to another webhost, so if you change your settings, of course, there will be a 404 coming from the current web host, because it will be trying to find the new site’s pages at the old web host. This is a several step process:

      1 – Point the nameservers to the Blue Host nameservers. They are currently not pointed there.

      2 – Change the Settings > General as instructed in this blog post, but they will be:

      http://cathedralcarejax.org/cathedralcarejax for the WP URL
      and
      http://cathedralcarejax.org for the site URL

      and edit and move the index.php file to the public_html folder as instructed in my blog post

      3 – You will need to use the Search and Replace plugin on the CONTENT only to rewrite any http://69.195.124.93/~catheds8/cathedralcarejax/wp-content URLs to be http://cathedralcarejax.org/cathedralcarejax/wp-content

      and any

      href=”http://69.195.124.93/~catheds8/cathedralcarejax/
      to
      href=”http://cathedralcarejax.org/

      If you need help with this process, please contact me via my contact form. It is straight-forward but many moving pieces which can get confusing. I charge $75/hour and can do this rather quickly.

  36. Angela, thanks for leaving such a helpful post. This is the 3rd time i’ve used it. This time, however, I did hit on something i’ve not seen before. Although all the links updated fine, the logo was still linking to the subdirectory. I tried the permalinks / .htaccess everything. It transpired that the theme had been built with the logo automatically looking for ‘wpurl’ which is the wordpress url – or subdirectory in our case. To counteract this I changed ‘wpurl’ to ‘siteurl’ and this fixed the problem. It should also mean, if I change things back or move the site elsewhere it should automatically take the correct url. Just thought it might help others if they hit on the same issue. Thanks again. Silver

    • Hi Silver,

      The problem with the logo linking to the wrong URL sounds more like an issue with the theme’s coding than anything you may or may not have done wrong and certainly nothing to do with the permalinks or .htaccess file. Many theme developers are just so-so in their coding practices, and it sounds like this theme has the logo linking to the wrong automatic url (in this case to the WP URL rather than the Site URL). It should be a simple change in the header.php file or one of the function files of the theme. Typically, the link is generated via the bloginfo php template tag and the variable should be set to url rather than wpurl, e.g.

      bloginfo(‘url’)

      instead of

      bloginfo(‘wpurl’)

      So look at your header.php file and check the coding around the hyperlink around the logo and let me know what it says. You can shoot me a direct message via my contact page if you want.

      Angela

    • Glad I could help. Yes, this is why I had included it on this FAQ under #5 for “old site files” and specifically listed the index.html. However, I should rename the heading, so people know it can also apply to index.html placeholder files that the host puts in the FTP directory.

  37. Hi I followed the instructions in your other post (copied the index file which I changed to ‘./wp/wp-blog-header.php’); in the public_html folder along with the .htaccess file.)
    I have gone through your possible issues/solutions and none have worked.
    Also tried doing the same thing with the www folder but no luck.
    I used softaculous to install. When I go to my site it shows a white screen but if I go to .com/wp/ I see a 404 error in my theme.

    Any help would be appreciated.
    Thanks

    • Hi Michael,

      It sounds like you might have typo somewhere. .com/wp should go to a 404 page, because the site should no longer be viewable from the subdirectory. However, you should login via .com/wp/wp-admin.

      I’m not sure what you mean by “tried doing the same thing with the www folder.” You should not “do” anything to your www folder. Basically, you need to have edited your General Settings in WordPress to remove the subdirectory from the Site Address (URL), then moved the index file to the public_html folder and made the edit as you described.

      I need more specific details than “none have worked.” What specifically is not working?

      Thanks! It’s usually something very simple and most often a typo or someone missed a step in the process. The site should display at the .com. The only other issue that can happen with some hosts, like Network Solutions, is when the hosting settings point the domain to the subfolder. In that case, if you try to do this process, it won’t work, because the domain is not pointed at the public_html folder. Let me know if you are on NetSol.

      • Regarding my www folder it appears to contain a duplicate of whats in the public_html folder and might be the root directory.
        “none have worked.” refers to the solutions I have attempted.

        I doubt it is a typo as I have reinstalled/reatempted it a few times. My host is hosterbox.com and sounds like its the problem.
        In softaculous it has the Installation Details and states the URL as .com/wp I tried changing it to .com however it reverts back to .com/wp
        Could this be the problem?
        Thanks

        • Ah! Okay. The www is a shortcut to the public_html, so they are one in the same.

          Would you like me to take a look at it? You could visit the About page and email me directly. It usually only takes a couple minutes for me to figure it out, and yes, it’s possible it’s the script doing something weird, but hopefully we can work around that.

  38. Great stuff. I had already done all the moving stuff and hit that snag. Your suggestion was a perfect and better yet easy a fix!
    Mucho thanks :) :).

  39. Hi and thanks for the info, it worked great….but. Being a twit and a newby to wordpress I put my new site in blog sub directory while building and now that has become my sites home page. Just what you warned about, too late for me though! How can this be fixed without having to redo all the image links etc?

    Oops.
    Jerry

  40. I’m using this setup on a couple sites so far and it’s really a lovely solution!

    However, I have an issue on one of the sites, this site uses an event plugin-in. I’ve talked with the developers, great folks, great support and they don’t think the issue is with the plugin – neither do I. The hosting company has also looked at whatever they can on their side and they don’t see any issues.

    So I was wondering if this setup would possibly have something to do with the issues we are experiencing which is the inability to login to book an event after creating a user account.

    When people book an event for the very first time, they fill out a booking form and a user account is automatically created for them.

    When they go back the next month or whatever to book another event – they can not login.

    They enter their username/pw, the page refreshes and the booking form – which should not be on the page for logged in users IS still on the page – so they are not logged in.

    If they fill out the booking form again they get a message that they already have an account.

    Login in via the WP login page does work, they are logged into the admin, but when they view the site, the booking form IS still on the page – meaning they are not logged in – and can not create a booking.

    I have this exact same site (my original mockup) on my own server and everything works perfectly. The only difference between the installs is different hosting companies, AND I have used this “moving” method on the site I’m having login issues with. Could this method effect someone’s ability to login in on the site?

    Thank you!

    • Hi Susan,

      I do think this is an issue with the plugin. The reason being is that some plugin and theme developers reference the wrong bloginfo variable for their functions. They will reference the url instead of the wpurl or vice versa, because they never consider that the WordPress URL will ever be different than the site URL. They should look at the their code for those various functions and templates and be sure they are using the bloginfo or whatever filepath info they have coded to make sense for subdirectory installations.

      You can read more about bloginfo here of they are using that tag in their code:

      http://codex.wordpress.org/Function_Reference/bloginfo

      Considering you may not be able to get them to acknowledge the error in their coding (as I’ve seen many times with this issue even though it can be so obvious if you look at the code), then you will probably need to move the installation outside the subdirectory for things to work properly.

      Good luck!

      Angela

      • Thank you Angela, I just asked them about your suggestion and they said EM is not coded that way which is good news and bad. However the plugin version I’m using is an older version and possibly updating will take care everything but I’m not so sure since it works on the original mockup!

        Thank you!

        • Because the plugin is handling all that functionality, it is likely the plugin is what is not sending people to the correct URL, imho. So, if the plugin worked fine when you hadn’t done the URL change in the General Settings of WordPress, then the plugin did not handle the site URL versus WordPress URL correctly. This is assuming you don’t have a rogue .htaccess file out there that is mucking things up. Always keep your plugins up to date. That does solve many of these kinds of problems as they clean up their code over time.

          Also, when they said the plugin is “not coded that way,” that is not correct. Of course, the plugin has either PHP code or HTML code that handles which template is opened for their functionality to work. So, to say they don’t code any URL functions or any template URLs in some way or other is ridiculous. Of course they do! They have to or the plugin wouldn’t be a plugin, and you wouldn’t have any pages related to it open at all. Duh.

  41. Hello –

    Thanks for the instructions. I’ve been wanting to do this for a while…I originally installed my WordPress blog to mydomain.com/blog/, and now I’d love for all my stuff to simply appear at the root, so I’m likely to do the move as you’ve described sometime soon, but I really want my ducks in a row, since I need the transition to be relatively seamless for my visitors, as I do get a fair bit of traffic nowadays (not huge, but around 3-5,000 views daily).

    My big concern is with the Permalinks, and I just want to make sure I understand everything clearly before I do anything. Ultimately, what I’d really like to happen when I do the move is have all old permalinks still work beautifully (since I have a lot of traffic redirects from message boards and news sites that won’t update their links), but then redirect to the new root location. Basically, I want the best of both worlds….the articles to show at http://mydomain.com/article name/ but have http://mydomain.com/blog/article name/ still work. You mentioned a redirect script and I saw the comment on the .htaccess tricks, but haven’t seen an update.

    I’m not sure what the correct way to do that would be either…from the link it seems I should include:
    RewriteRule http://mydomain.com/blog/ http://mydomain.com/
    but I’m not sure if this’ll mess with the other WordPress calls from the subdirectory, and I’m not sure if it’ll work in the manner I’m hoping.

    So, in short, I’d like all old permalinks with the /blog/ directory to redirect to the post in the root, and I want all new permalinks to be created without the /blog/

    Can this be done easily?

    Thanks so much!

    • The tricky part about this is that if you do a wild card redirect on all the /blog URLs, then you won’t be able to login to WordPress because WordPress Dashboard PHP files, etc., are still located in the blog subfolder. How It’s easy to rewrite all URLs, but in your case, we don’t want to rewrite any of the WordPress file URLs image URLs because they will all still be in the blog folder and therefore still have /blog in the URL.

      You could use the Redirection plugin to manually rewrite the URLs. It’s very simple to use. Simply paste the old URL into the Source URL field and then type the new URL without the /blog in it in the Target URL field. I can see from your site that you have a lot of URLs but not an excessive number, so this may just take you an hour to do.

      http://wordpress.org/plugins/redirection/

      If anyone has a better solution, I’d love to hear it. I know some people have decided to keep /blog in their post URLs by modifying the permalinks settings to include /blog/ before the postname tag like this:

      /blog/%postname%/
      

      This will not effect your pages, but will allow you to keep the same URL for your posts as before, so you get the best of both worlds — the main pages and URL of the site not having /blog in the URL and the posts continuing to have /blog in the URL, so you don’t have to worry about redirects.

  42. Hi Anglea, I wonder if you could please help me. This tutorial seems to be on the right lines for me, but my situation is a bit different. Instead of a subfolder my wordpress URL is http://94.136.40.103/~timpeacock.org but my site URL is http://www.timpeacock.org.

    When using permalinks I can no longer preview pages, the URL of which is a timpeacock.org one because I don’t have the necessary permissions to view the page (I am effectively not logged in on the timpeacock.org site). If I remove permalinks then the problem goes away because then I can view the URLs as the admin I am – but non-permalinks don’t look very professional so I don’t want to do that. Any advice please?

    Thanks in advance,

    Tim

    • Hi Tim,

      It looks like you got problem worked out! What did you do? I imagine it was something simple.

      Cheers. Sorry for the late response.

      • Hi Angela,

        Yes – it was something simple (am a bit embarrassed actually!) My provider hadn’t transferred my site from it’s test location so all the “automatic” links were looking for something which didn’t yet exist. Thanks for getting back anyway!

        Tim

    • Hi Lindsay,

      Sorry for the late response. For some reason, my blog notifications didn’t reach me during this week that you wrote. Did you get your problem resolved?

      Thanks,

      Angela

  43. I followed your instructions and everything worked fine, but when I went to Google Webmaster Tools and fetched as Google I get an error “Denied by robots.txt”. Is it because it is in a subdirectory?

  44. Hi Angela, I used this technique on a Woocommerce theme and I’m getting some warnings in my products pages:

    Warning: array_pop() expects parameter 1 to be array, null given in /home/auxpieds/public_html/wpsite/wp-content/themes/room09/theme/metaboxes.php on line 103

    Warning: array_pop() expects parameter 1 to be array, null given in /home/auxpieds/public_html/wpsite/wp-content/themes/room09/theme/metaboxes.php on line 104

    Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/auxpieds/public_html/wpsite/wp-content/themes/room09/theme/metaboxes.php on line 105

    Is this a known issue? Anything I can do?

    • Hi Valerie,

      It’s possible that WooCommerce might have issues with a subdirectory installation. I would check on their support forums.

  45. Am building a robots.txt file for a site which we have installed in a subdirectory, but is “moved” to the root using the methods you outlined. Now I am just wondering how to make sure that the robots.txt covers everything… I am writing it like this:

    Disallow: /wp-admin/
    Disallow: /subdirectory/wp-admin/

    to make sure that either way things are not crawled – will this do any harm, or should be fine? I am hoping that having the robots.txt file up will help, as we seem to be getting massively crawled lately, to the point where I think bots are using up most of our bandwidth…
    Any suggestions you can offer?

    • You do not need the robots.txt file if you set your Settings > Reading to discourage search engines from indexing the site. If you are still concerned about the site being indexed or crawled, you can use an Under Construction plugin which will prevent any non-logged in users from seeing the site.

  46. Hi Angela, I recently upgraded my Godaddy hosting to deluxe and the links to all 6,000 images on my blog were broken. I have the same url, so trying to replace the url was not possible. Do you have any suggestions?

    • Hmmmm… that is really weird. If the URL did not change at all, then upgrading your hosing account should not have caused this problem. What is the URL of your site? It could be that your computer’s hosts file is still trying to find the site on the old IP address as the IP address likely got changed with your upgrade in hosting. Try to view the site on another computer and wait to be sure the new IP address has propagated throughout the Internet, which can take 2 – 24 hours. Be sure ALL of your files got transferred to the new hosting account. Call GoDaddy and double check that they really copied everything over. It could still be in process.

      • What’s even stranger is that it’s been over 2 weeks. The permalinks or image links are visible, the picture just doesn’t show up. My IP address has changed, but I don’t know where I could even enter that info. GoDaddy helped me do the transfers and I even re-uploaded my UpLoads the following day. Could find no help on Google or WordPress.org forum. I started adding pics manually a couple of days ago, but am no where close to finishing (probably got to page 13 or so). My site is http://www.fashionrollcall.com. –

        • Just realized that my media URL’s are pointed to an absolute path. I have selected the default upload folder, yet it remains the same. I’m unsure how to fix this absolute path, but that’s the problem.

  47. Hey Angela, I actually moved my today, and as of today I click the tab to move to root directory and after a few mins the homepage moved but no internal page worked, i logged back into my wordpress backend and changed the permalinks and then resaved as postname and everything was perfect, all images and internal links a fine, and I didnt have to do anything other than redoing the permalinks.
    I was very nervous before doing it but it couldnt have been more easy!!

    • Thanks, Mark. I think the only thing I’m uncertain about with the GoDaddy process is if the URLs to the images and internal hyperlinks are rewritten or not. That would be nice if they have a script that does that, but I think perhaps this might just change the General WordPress Settings and move the files.

  48. Hi Love:

    I had a major problem!
    After installing a plugin and putting some data on its page…. I was kicked out of my site??
    The authentication would go on loop for ever??
    I lost full 5 days on it!

    I posted many help on wordpress, wrote to the plugin builder, restore my data to previous days, etc etc ….
    Nothing helped. Till I got to this page. I followed your instructions step by step (have never used these stuff b4!!)…
    PROBLEM solved in 20 seconds..

    Many thanks from CANADA….

    • Wow! Danny, that’s amazing. I’m so glad I could help virtually. I plan to write more blog posts about practical things like updating, dealing with plugin conflicts, etc. Good luck with everything. Feel free to write if you get stuck with something again.

  49. Hi Angela, these instructions are great. My problem is my client is on a Windows server and the permalinks are actually working just fine, but there are some font image icons missing from the slideshow on his homepage. I can’t see this on my browser, but he noticed it on IE 10. Do you think this problem could be related to following this procedure and being on a Windows server or something else? Of course I can’t edit the .htaccess file since it doesn’t exist. And, fyi, I had gotten the permalinks to look right by doing a 404 redirect. Any help is appreciated.

    Thanks.

    • I would recommend moving them to a Linux web host. There is no reason people can’t purchase Linux hosting. Windows is not a good environment for WordPress to run in. In terms of the slider icons, it could be the plugin for your slider is looking for the wrong path for those icons (which is bad programming on the part of the plugin developer). But, definitely, migrate the client to a Linux web host such as greengeeks or hostgator. If you use my hostgator affiliate, I would migrate them for free: http://askwpgirl.com/go/hostgator.php

  50. Hi Kevin,

    These instructions do NOT work for SUBDOMAINS. They only work for subdirectory installations. Your site was installed in a subdomain, which is very different from a subdirectory installation. As a result, the site will be very messed up doing this process. The instructions ONLY work when the site is installed like this:

    mysite.com/subdirectory

    NOT

    subdirectory.mysite.com

    You will need to follow the instructions at WordPress.org for MOVING your site to the correct root directory folder and doing a search and replace using SQL or the Search and Replace plugin to change the URLs on the site.

    http://codex.wordpress.org/Moving_WordPress

  51. Hi Angela,
    I have a problem and need your advice.
    I installed wordpress in a folder in the public folder (lets just call it “blog”). Initially, I was using “blog.domain.com”.
    Following your instructions, I changed the site and url from blog.domain.co.ke to http://www.domain.co.ke and i copied the index.php to the public folder and changed

    to

    after which I saved the permalinks. I could access the site but could not access the posts. So I copied the .htaccess to the root folder as well and I updated it and it now looks as follows.

    # BEGIN WordPress

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

    # END WordPress

    The site works fine, although I have noticed that users cannot be able to log out.

    The problem is, I’m not able to log in to wordpress admin on any browser. When I enter

    http://blog.domain.com/wp-admin/
    http://blog.domain.com/wp-admin
    http://www.domain.com/wp-admin/
    http://www.eajoblist.com/blog/wp-admin

    None works and the url changes to

    http://www.domain.com/login/?redirect_to=http%3A%2F%2Fblog.domain.com%2Fwp-admin%2F

    This basically takes me to the website log in (which as I said before, refuses to log out). So, i’m not able to access the admin panel.

    However, the wordpress page that I used to make site changes still works and I fear closing it because I might not be able to get back in.

    I have checked my sql database and the site and home urls are correct.

    What do you make of this?

  52. wow. my client is hosted on yahoo, and you kind of indicate this “how to” will not work on yahoo,
    but ive gotta ask: is there a workaround way this solution will work with yahoo?

    • My answer is to migrate them to Host Gator and ditch Yahoo. Yahoo is not a good WordPress host in my experience. They do not have .htaccess files accessible, and in general, WordPress does not run well on Yahoo hosting. It’s kind of a pain in the butt. If you have them sign up for a Host Gator account under my affiliate link, I would be happy to help you migrate them for free: http://askwpgirl.com/go/hostgator.php

  53. I just successfully moved my site to the root from /wordpress and I can view all the pages fine, but it is showing the /wordpress directory in the URL. So each page can be viewed fine with or without the /wordpress directory. How do I “hide” the directory? I updated the permalinks, but that didn’t seem to do anything.

  54. I followed the instructions, but cannot seem to get it working. My website and login are inaccessible. I triple checked that I did everything correctly, so I’m not sure what else it could be. The only thing I haven’t done is removed my existing site from the root because I’m a little scared. Is that the only option I’m left with?

    • You can move your existing site in a subdirectory, so you don’t have to delete. Having the index.html for the old site still present creates lots of problems.

      Your WordPress login will continue to be via the subdirectory, because you have not moved WordPress, you have simply indicated to WordPress to display the URLs for posts and pages from the root rather than the subdirectory. Other than that, the entire WordPress installation and uploaded files are still, of course, in the subdirectory since that was not moved nor do we want to move that as it creates other issues.

  55. I thought I successfully made the switch from my “wordpress” subfolder to my client’s main domain, however parts of the website still only work if the “worpress” part of the url is typed. For instance, my client’s portfolio page is here:

    http://woods-assoc.net/index.php/projects/

    But when you click on any project, the links don’t work, even though that is the correct permalink. You must include “wordpress” as part of the url, for example:

    Link should be — http://woods-assoc.net/index.php/portfolio/tanner-monagle/
    But only works as — http://woods-assoc.net/wordpress/index.php/portfolio/tanner-monagle/

    Also would love to remove index.php from the url also. Thanks for any help or tips!!

    • It looks like you are perhaps on Windows server (because of the index.php in the url), which sucks for WordPress permalinks. I would never recommend Windows hosting or Yahoo for WordPress, because of issues with permalinks. I don’t know why her portfolio needs to include WordPress in the URL. With this set up, ALL of the uploaded files are of course in the WordPress directory because that did not move, hence why you also need to login via the WordPress directory. WordPress LIVES in the subdirectory. It was not moved, the only thing that changed was to have the URLs aka Permalinks rewrite from the root direct.

      If you are on a good Linux web host, then you can remove the index.php from the URL, but that is ONLY if you are on Linux/Apache web hosting.

      You can try regenerating your permalinks to see if the portfolio works without the wordpress in the url. I just checked the site, and it looks like you got that working.

      • Hi, yes I was able to figure this out by adjusting some settings. I’ve hired a freelancer to help me with a mod rewrite to hopefully get rid of the “index.php” part. Thanks!

  56. Hi and thank you for this great website. I have read through this post and the comments about having WP in a subdirectory and setting it up to run from the root and I think I know what to do for the most part. I still, however, am confused about htaccess (I am always, always, always confused about htaccess).

    I now know from your site that the htaccess I will be copying to the root is the important one. I have a couple of things that are still fuzzy to me, though…

    !) The guide at codex.wordpress.org/Giving_WordPress_Its_Own_Directory says to copy don’t move the htaccess. It that right? I leave an htaccess in the subdirectory? And does this htaccess in the subdirectory have just the “#Begin WordPress …. #End WordPress” stuff in it and nothing else? And the htaccess in the root has all the “Options All -Indexes” stuff in it?

    2) Caching and security plugins write to the htaccess file. So which one do they write to? Do they know to write to the one in the root or do they write to the one in the subdirectory? Or do they even work if WP is in a subdirectory?

    Thanks for any help you can provide me on this. You have quite a knack for explaining things to non-developers. When it comes to htaccess, most of the help I find just makes me more confused. :)

    • The .htaccess file can certainly be moved to the same directory as the index.php file. Sometimes that is needed on some servers, to have it at the higher level. It won’t hurt to move it there and then reset your caching and permalinks to get those to be rewritten.

      The most important thing for this process is that you need to turn off caching and remove ALL caching information from the .htaccess file before doing this process. Then, after you’ve moved the index file, go ahead and go to the Settings > Permalinks and click the Save Changes button. And then, re-activate your caching plugin and it should write to the .htaccess file at the root.

  57. Hi, thank you for the clear advice here. I’ve been having issues after trying to edit the htaccess file; my WP site (which is in a subdirectory) now won’t load the static home page, although all the blog posts are fine. If I change (in the general settings) the site URL to include the subdirectory, the home page loads but obviously then the site is no longer moved to the root, and all the links are different.

    I had backed up the original htaccess file from the root (there wasn’t one in the subdirectory) which included the wordpress rewrites for permalinks – however, this now no longer works. WordPress seems to want to generate a htaccess file in its own subdirectory (which, confusingly is public_html – as is the root) but its presence doesn’t seem to matter one way or the other – I can delete it or leave it and the site behaves the same; when it’s added to the root file, however, everything stops working altogether.

    I feel it may be something to do with the index.php file(s), but
    am tying myself in knots trying to figure out what’s going on.Any help would be appreciated! Happy to hire you for a bit since I think it would be the easiest way – but would dearly love to know what I’ve broken, so I don’t do it again!

    • I’m so glad you contacted me directly, and we figured this out. For others who might be curious, the problem was that the old site’s index.html was still in the public_html directory, so it was competing with the WordPress index.php file that was copied there. There was some funky stuff in one of the .htaccess files, so we renamed it and went to Settings > Permalinks and clicked Save Changes to force WordPress to rewrite a new .htaccess file.

  58. Currently have the blog under a sub-directory and a static page in the doc root. My goal is to have WordPress handle the doc root as the landing page and show e.g. the latest posts and information from other sources, but keep the sub-directory intact so people can still reach the current blog address, which would then present blog posts.

    My strategy was
    1. use your steps above to let WordPress handle the doc root
    2. change the WordPress front page to be the landing page as I mentioned above.
    3. Make a WordPress Page for the blog
    4. Use .htaccess to redirect the blog sub-directory http address to the new Page created in step 3.

    I have some knowledge of WordPress/Apache http but not enough to be confident. Is this the best way to go about this change?

    Thanks for being so generous with your time and know-how!

    • That sounds quite a bit more complicated than it needs to be. You can follow my instructions to let WP handle the doc root. Then, you can create a blog page and set your Reading Settings to use this page as the Posts page. That’s all. No need to deal with .htaccess redirects. With a single install of WP, you don’t want to do anything weird with redirects because that would likely mess up all the hyperlinks and make them not work. However, if you already have a lot of incoming links to existing pages in your subdirectory install of WP, then you would want to use the Redirection plugin to redirect those old links to their new URL after you’ve followed my instructions. Good luck!

  59. I am about to make this transfer from subdirectory to root as I am almost done with my testing sandbox, but I have a critical question: Does this redirecting technique interfere with SEO or crawlers in any way?
    Thank you,
    Mark Zollitsch
    Abundant Family Health

    • Hi Mark, I saw an old blog post that mentioned that for some strange reason, but I couldn’t find any rationale for it. The URLs will work identically whether the WP application itself is in the subdirectory or in the root. I haven’t seen any crawl problems or canonical issues. It’s also a technique WordPress.org recommends for keeping the directory structure clean (http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory). The only known issues are with WP Multisite — it’s not recommended to use Multisite in a subdirectory.

      Good luck!

  60. I have been building my website for the past few days and after moving the wordpress folder contents from a sub directory into root, replacing all the subdomain extentions using notepad, my website is in the right place but looks like it has lost a few days worth of editing. When i log into wordpress admin panel all the work is up to date, and updating my pages etc does nothing… any suggestions?

    • I was having this same problem, but when I went into general settings I noticed a message that said “One or more plugins have been activated or deactivated, please empty page cache.” Clicking the “Empty Page Cache” button solved the problem.

      • Thanks, Jacob. I need to add to the FAQ that people should de-activate their page caching program and then re-activate and delete the entire page cache.

  61. Add on to earlier comment about losing ability to preview changes after doing this. Forgot to mention the error I have. When pushing preview on a page i get: ‘You do not have permission to preview drafts’

  62. Thanks for this, I have one problem though. The site is working great for visitors, but when using the admin I can’t preview any changes I do anymore.
    I had to copy the .htacess file as well. Haven’t done any changes in it.

    • Remember, you’ll still access the WP Dashboard via the subdirectory. Preview of pages should work just fine. I’ve never seen that not work. You might want to rename the .htaccess in the subdirectory if there’s still one there, and then edit the .htaccess in the root directory to match the settings specified on the WordPress.org site: http://codex.wordpress.org/Using_Permalinks#Where.27s_my_.htaccess_file.3F

      Backup your current .htaccess file first.

      • I’m having this same problem–previews not showing up. Accessing WP Dashboard through the subdirectory, .htaccess matches the WP settings, there’s no .htaccess in the subdirectory. Not sure what’s wrong. Everything else works great.

        • For some hosts, you do need to have the .htaccess in the root where you displaying the site from and some others in the subdirectory, but you don’t want to have two versions. The highest level .htaccess should apply to any subfolders. I would try putting the .htaccess where you moved the index.php file and then go to Settings > Permalinks and click Save Changes and see if that solves the problem. (Be sure to delete or rename the one in the subdirectory.)

          • P.S. You may want to clear your browser cache and delete any cookies you have in your browser, then log in again to the site. Could be a weird cookies issue.

          • Still not able to preview. Not sure what’s going on. I get a “Page not found” message. Everything else works as planned. I think it must be a redirect thing, because the preview does immediately redirect to the new domain name. Any ideas?

          • Hi Jeff, What are your settings in the General Settings? Often people make a typo and end one of the URLs with a forward slash, and they shouldn’t. Little things like that or a typo in the index.php file can result in this type of behavior. Email me via my http://moongoosedesigns.com contact form, and I’ll reply back and have you email me your index.php file, .htaccess file and a screenshot of your General Settings.

  63. I have successfully used your method to re-direct my WP site to the root directory. Your tutorial is clear and concise, and I used your trouble shooting area to fix my first, broken attempt. Thank you SO much for your efforts!
    BUT I just tried to re-direct a second WP site, and I cannot get it to work. The difference this time is…. WP is installed in a folder (called ‘site’ ) in an add-on domain! I have searched all over and cannot find an answer to this problem.
    Here’s the set up…
    My main domain is ‘anniewarren.com.au’. I have a WP installation in a folder called ‘site’ and it is now re-directing beautifully.
    I also have an add-on domain called ‘lavishstudio.com.au’. The WP installation is in a folder called ‘html’. I have completed all the same steps, but it isn’t working. I just see a ‘content of index’ page.
    Do I need to add a sub-directory info to the wp-blog-header  because it’s an add-on domain? Oh dear, I’m very confused…
    Annie

    • It looks like lavishstudio is working. I can’t tell from your description what the problem is. I hope you worked it out!

  64. Just wanted to comment on how great a resource your site is.  I had a few glitches in my install, especially after the last WordPress update, and following your install and FAQ articles helped me check some files.  Wordpress now thinks my .htaccess isn’t writeable when it is, but that’s a minor thing compared to the random behaviour that was going on!  Keep up the good work!

    • Thanks! .htaccess ends up being the bugger most of the time with these situations. Also when people are on Network Solutions, there’s a setting in NetSol that can cause problems for people, so I’m going to write some more about that in my FAQ. For the .htaccess, you can always edit it manually. Be sure to have just one .htaccess. Multiple occurrences (in the root and in the subdirectory) can really confuse things. Just keep the one in the root. Also, if you had been using a caching plugin, that can make things weird, so you’d want to turn that off, delete all the caching settings in the .htaccess for the caching. Be mindful of any PHP versioning control in the .htaccess. Some hosts use the .htaccess to control the PHP version you are using, and if you delete that command, then the site will go down. Always good to back up .htaccess before you modify it.

  65. Hello,

    I carefully followed the instructions several times – great info,btw.

    All of my internal pages show perfectly  every time,

    But my home page says: “Not Found — Apologies, but the page you requested could not be found. Perhaps searching
    will help.”

    very frustrated and not sure what to do.

    • I imagine the issue is that you have HOME in your menu coded to go to the old home page URL in the subdirectory. You can change that link in Appearance > Menus.

      • Thank you so much for your reply. That got me in the right direction. I hadn’t set up a menu yet, but the permalink for the home page was set at the original “Hello World”. I simply edited and updated that – problem solved. Thank you very much – problem solved.

      • Hello Again,

        Your advice put me in GREAT shape.

        Now when I make the change the “home” doesn’t show as a prefix in every url – awesome.

        but new problem –  I lose the ability to show all of my posts on the same page.

        If I switch back to the old way all of my posts show on the same page.

        Then if I move the index file to the root (much preferred) the posts won’t show on the same page, instead that little arrow referring to the next post, etc.

        Please, please help, thanks.

        • I have a lot more questions about your set up that I would have to ask to troubleshoot this for you. At this point, if you’d like to hire me for 15 or 30 minutes, I think I could help you by being able to login and look at the files and talk to you on the phone. Please email me via http://moongoosedesigns.com contact form.

  66. Ok, i originally installed my wordpress files into the root of my hosting directory in Godaddy (dumb I know). After everything was working great. After about 3 days, I decided to move the install to a subfolder. I followed all these instructions, and I am even able to login with the example.com/subfolder/wp-admin just fine. Problem is that after about 5 minutes, I begin to lose all the images, as in only the placeholders or the red x shows up (depending on the browser). I am at a loss. I do know that if I put all the original files back in the root, everything works fine again. What am I missing? Again the pages are working fine, but the images don’t show up.

    • Hi Joseph,

      It’s not dumb to install in the root directory. Many people prefer that. This blog post is for those people who installed in a subdirectory because they had an existing site in the root, then want to be able to see their WordPress site in the root instead.

      There is no reason to move WordPress to the subdirectory, and these directions are not meant to be used for that, and yes all your image links will be broken as a result.

      The reason you “lose” your images after 5 minutes, is because your browser cache had the stored images. The images are no longer in the location they were in the root. You can use the search and replace plugin to search on the old image links in the content of your posts and replace with the new URLs.

  67. Thanks so much!  I’d misread the instructions on the WP site and locked myself out, this FAQ was nice and easy to understand and I managed to fix the schoolboy error :)

  68. Hi Kelly,

    Usually this is because one of the steps was not done correctly. Have you checked the database wp_options table in the FAQ to determine if the URLs were correct? If you still have trouble, please contact me directly at http://moongoosedesigns.com I can probably figure it out in 5 minutes. Can you still log into WordPress?

  69. Hi, I have followed your directions to move my index.php page to the directory just above the wrodpress main folder and keep seeing this message.

    I  have checked permalinks, php-myadmin looks correct, code in index.php has been changed to correct folder ( (‘./wordpress/wp-blog-header.php’); and I am still getting this message and not seeing my site. I can’t view it now either when logged into WP. Get the same message – any ideas please

     Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/childtal/public_html/index.php on line 17

    Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/childtal/public_html/index.php on line 17

    Fatal error: require() [function.require]: Failed opening required ‘./wp-blog-header.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/childtal/public_html/index.php on line 17Thanks Kelly

  70. Hi, I have installed WP successfully for the first time and since I wanted to “get it right” from start, I was happy to have stumbled upon a friends suggestion to do a manual installation, install it in a subdirectory, while showing from the root, along with some applying some “security by obscurity” settings (use an administration account other than ‘admin’ and a custom table_prefix). I then found your great guide, too and it all gave me the confidence to go ahead and install WP manually with these settings, for the first time, and it all works fine (slap on my shoulder – lol).

    I just have a few questions:

    1. According to your instructions, the .htaccess file only needs to be moved to the root domain (public_html) for some hosts. I just checked via FileZilla and noticed that my .htaccess file is actually in the root domain (by default?)! I host with Hostgator and this is actually the first site installation on this cPanel hosting account, nothing was on it before.
    So when I installed WP in a subdirectory, and the .htaccess file is part of this installation, and all I have placed into the root domain, how come the .htaccess file is there?

    On the other hand, doesn’t it make sense for it to be in the top level domain (public_html)?Does it only serve the WP installation, or let’s say I will add static html pages to the root domain (not carrying names equal to WP files)…would they not require the existence of a .htaccess file (for whatever reason?). So you would not have two sets of .htaccess files, one in the root and one in the WP subdirectory? Maybe I am not exactly sure yet what other purpose it serves.

    2. While I have created and placed a blank index.php file into the WP subdirectory, after moving the original one to the root domain (with the adequate changes made in it), I am a bit confused as to what exactly you actually mean by saying this would “prevent people from reading the directory contents”…..because I checked my site and while I get a blank page when I browse http://www.mydomain.com/mysubdirectory/.. , I can however see the contents of http://www.mydomain.com/mysubdirectory/wp-includes/ (there are many .php files) and all the images http://www.mydomain.com/mysubdirectory/wp-includes/ .So could you explain how this placement of a blank index.php file would prevent people from reading the directory contents, when they just need to add wp-includes or other further subfolders to have the content appear?What would you suggest that I do to restrict access to any subfolder contents?The robot.txt file? Would that then go into the public_html folder?

    3. What permalink structure should I choose right off the bat…when I just installed WP with the default theme (twentyeleven)? I am yet to choose a theme and install plugins, i.e. SEO plugins. Currently I have set it as custom %postname% only, according to some research I have read up on. But at what point should I install an SEO plugin, and will this hook into the WP permalinks to override my current setting? Where does the canonical links, created by SEO plugins, come into play here?

    4. I have no real content on my new site yet, just two test posts, but Google shows me this when I search for “mydomain”:

    Index ofwww.mydomain.com/Index of /. cgi-bin/ · moving.page/ · suspended.page/. Apache Server at http://www.mydomain.com Port 80.

    Hostgator has two folders “moving.page/” and “suspended.page/” in my public_html, each containing an index.html page. That should not be indexed, or perhaps not be there, at all?Would you recommend I just delete them? Why are my two posts not show in Google’s index yet? Or perhaps I need to install the SEO plugin and make proper settings?

    Thanks a lot :)

    • Here you go:

      1 – .htaccess works hierarchical, so whatever is set at the highest level applies to the folders beneath that level.

      2 – The “sensitive” folders (such as the wp-content, themes, and plugins folders) do have a blank “Silence is Golden” index.php file in them. It’s hard to completely obscure the fact that you’re using WordPress (nearly impossible), and the wp-includes folder does not contain any sensitive files (everyone knows what’s in that folder), hence it doesn’t include the blank index.php file. However, I usually add a line to my .htaccess file to not allow directory listings. It looks like this and will apply to all folders beneath and including the folder the .htaccess is in:

      Options -Indexes

      Or you can install the Silence is Golden Guard plugin.

      3 – I usually just use the postname permalink structure. If you have a blog, bloggers often like to use the structure that includes the date because they like to show the date in the URL. It’s a personal preference. Others like to include the Category in the URL which with the latest version of WordPress is less cumbersome on the server. I would use the All in One SEO Pack plugin. There was an interesting article about canonical url issues related to WordPress being in one directory and the URLs displaying from the root, per the instructions in my post:

      http://www.wealthydragon.com/2009/04/22/all-in-one-seo-pack-pagerank/

      However, I don’t see how what he says at the bottom of this post is possible. Warrants some more investigation, but it’s confusing. Having a good robots.txt file can be helpful. Here are a few posts:

      http://codex.wordpress.org/Search_Engine_Optimization_for_WordPress

      http://yoast.com/example-robots-txt-wordpress/

      http://perishablepress.com/wordpress-robots-rules/

      4 – It’s possible that those weird pages were indexed a long time ago, and it will take some time for Google to recrawl your site and for those to no longer display. Be sure to turn off the Privacy setting in the WordPress Settings, so you are allowing search engines to search the site. Also install the Google XML Sitemaps plugin and create both a Google Analytics account and a Google Webmaster Tools account. Submit your sitemap to Google Webmaster Tools.

      • Hi, thanks for your reply. After I have installed WP in a subdirectory and have it showing from the root, I am now getting increasingly confused as I am reading up on all these things:

        All-in-one SEO plugin messing with canonical urls (Not generating canonical url’s using the root folder but that of the subdirectory -as per your link- and for multipage posts and pages, NOT generating the second, third etc. canonical URL’s, resulting in only the first part of those posts/pages to be indexed!).Not sure if these issues have been fixed, but many seem to have disabled AIO’s canonical function as a result. I have not installed any plugins so far, still doing prelim. research…but so many contradictory and party outdated (or not?) info out there…making it hard to know what to do NOW!Then this WP issue with using %postname% up until WP v 3.3 (http://digwp.com/2011/06/dont-use-postname/) … I honestly don’t really understand the issue there is (was?), or how it could come to this, after reading that Digwp article). All it says (even under WP’s codex permalink page) that /postname/ is fine to use as of 3.3.
        You would think that after all these years with WP, such a database related thing would have been discovered and fixed earlier? Is it really safe to be using %postname% only now? Or %category%/%postname% ? Why would WP find it difficult to differentiate betweeen a post and a page, especially since each URL’s are unique? Is it still better to be using a number (i.e. year) ahead of the post url?I also noticed that YOU have actually not installed WP according to your instructions here…it’s installed and displaying right in the root folder.
        What made you go for this option?

        I never knew how the file structure would look like for a WP install, and now that I have done it for the first time, I agree that it looks much neater in a subfolder … yet I am now wondering if this was really necessary or has any other downsides? It’s not really that obscured, and I am not sure if it really prevents hackers from most “global” attacks. I did, however also change the table prefix from _wp to something else, so maybe that would be enough from that perspective?

        • I think you’ve confused yourself above and wrote exactly the opposite of what I wrote. The URLs — ALL OF THEM – come from the root directory NOT the subdirectory – when you follow this process I’ve outlined in the post. NONE of the URLs except the images and uploaded files will show the subdirectory.

          I honestly don’t “get” what the article I linked in my response is trying to say, because I’ve NEVER seen the links from the subdirectory, so it’s possible that person did not know what they were talking about. There’s a lot of misinformation on the Internet.

          In terms of Permalinks, I use postname all the time, but I mostly code non-blog sites who use WordPress as a CMS not as a blog. The person on that article recomends to use:

          “Personally, I’ve opted to start my URL’s with /%post_id%/ then also use /%postname%/. It looks a little weird maybe, but I don’t overly mind it. Performance is more important to me.”

          So, if you agree with that, then that would be the permalink structure to use.

          That’s very curious about the first, second, third pages not being “indexed.” I’ll have to test that. I’ve never encountered that to be an issue with the subdirectory install, but I’m so glad you wrote to me about it! Many of the issues posted regarding AIO are old.

          • I actually did understand exactly how the URLs all come from the root directory :)  I was referring to your referenced article about the issues pointed out by this guy regarding the AIO plugin allegedly causing Google to index the site’s pages and posts by including the subdirectory…even though I agree it does’nt make any sense.

            In researching this “issue”, I came across other issues with regard to the AIO plugin, as reported by other people. The following is the article where the writer points out a “bug” that would cause multipage posts and pages to only have their respective base page indexed, but not the second, third etc.

            http://www.vijaypadiyar.in/blog/2011/12/all-in-one-seo-pack-breaks-canonical-urls

            I don’t actually like the inclusion of post_id’s in post URL’s … to me it looks silly. To a degree, I can relate to including the year and month but according to Yoast, it is a silly move, too as people don’t actively look for a date in the URL, rather than at the beginning of the actual article. I agree with his view, that having the date including in the URL it could mean lower CTR’s as when people find your link through a search, they may be put off if they see it might be a year old, and won’t even click it.

            Do you know the link inside of WordPress.org where they explain for each version update what it was that was actually updated? I’m just asking because I wish to understand more about the issue raised about massive database queries as a result of NOT using numbers ahead of words in permalinks, which they say was resolved in version 3.3.

          • If you’re looking for an alternative to the AIO, the SEO people I work with in town use SEO Ultimate: http://www.seodesignsolutions.com/wordpress-seo/

            WordPress did update 3.3 to make those queries more efficient. I thought it /%category%/%postname%/ that was “forbidden” until 3.3 because of the inefficiency in relation to database calls.

            Here’s a good article:

            http://www.dailyblogging.org/wordpress/seo-wordpress-permalink-structure/

            Here’s the 3.3 feature list:

            http://codex.wordpress.org/Version_3.3

  71. Very useful article!
    I just wanted to note that in the case of copying the index and htaccess files to the root but still running wordpress from a subdirectory, make sure there are no similarly named files in the root.  

    The problem I was running into was the site used to be php pages and the new one is wordpress. There were some php pages in the root from the old site that were sharing names with the new pages in wordpress, so those php pages had to be deleted or moved into a separate directory.

    • Very good point, Sarah. I included this tip in the FAQ on the post as I had another contributor who created the exact same URLs as their previous PHP site and ran into the same problem because they had not remove their old site from the root first. And, in Step 2 of these instructions, there is a note that people should backup and delete the old site’s files before they move the index.php file to the root.

  72. Just wanted to thank you so much for all the info you posted.  It was extremely helpful!!! I just started working with WordPress a few weeks ago.  I converted a site by creating a sub-directory and wanted to transfer it to the root.  I ran into all sorts of problems and your site saved me!  Thanks a million!
    Janet (Toronto, ON, Canada)

  73. Very clean guide thx!  Didn’t work for me in the first place,keep getting 404 error. Then after a ridicolous amount of time , I realized my new index.php file was created WITHOUT “reading permissions” LOL

  74. Hi, 

    On #6 you state, “I’m testing out an .htaccess command you can use to rewrite all the URLs. I’ll post it here when I’ve tortured tested it.”  DId you ever test this method?  We recently moved a site and have a different file structure with over 1000 posts. 

    Thanks

  75. Thanks for this post, and especially step 8. I’ve done this specific move a couple of times (start in a subdirectory then make it look like the blog lives at the top-level domain). After the move it’s minor pain to deal with broken links that have been manually created between pages in the site’s content. 

    I wondered whether I was doing something wrong, since most tutorials just talk about the permalinks and don’t mention anything at all about broken internal links. I came up with the same method as you: search/replace once to update the internal links, then a second time to revert any wp-content links to the old structure.

    It was a relief to find your post and see the same process.

    One thing worth noting: according to Moving WordPress in the Codex (https://codex.wordpress.org/Moving_WordPress) we should only do this search/replace on the wp_posts table. Doing it on other tables, like options tables, can cause problems.

    BTW, your search/replace example in 8 might have a typo. I think you meant the “replace with” part to say a href=”http://yoursite.com/.

    Thanks again.

    • Hi Andy, Very good point! I’ll modify the post to emphasize to only look in the posts table for the search and replace. I, too, have totally messed things up by searching and replacing all.

  76. Hello. 

    Thanks for sharing such helpful tips about a topic that could be pretty overwhelming. I was wondering what the difference would be in the step if my subdirectory site was at wp.mysite.com and trying to get it to mysite.com? What would the “require” line in the index file look like since it doesn’t seem like it would recognize the changes. 

    Thanks again!

    • Hi Tim,

      I recently did have to do something similar where I had set up store.mysite.com and needed it to be http://www.mysite.com. How we handled this was to point the A Record for the www site to store.mysite.com folder on the server since store was set up as a subdomain and had it’s own folder. Once that was done, I changed the URLs in the General Settings to www for each of them, then had to log in again and use the Search and Replace plugin to change all instances of http://store with http://www in the posts. This worked well. So, the instructions I wrote in the blog post you commented on really don’t apply in this situation since you aren’t “moving” WordPress – you’re simply changing the settings and making sure the domain is pointing to that folder, which is something your web host should be able to help you out with. If you already have a site in the www and pointing the www (or non-www as the case may be) to the subdomain folder is problematic, then you could use a plugin like BackupBuddy to backup the entire site. It has a nifty importbuddy.php file that you use to restore the site on the new domain. I use it all the time for migrations, and they have a great video tutorial. I would recommend getting it anyway to do regular full backups to the Amazon S3 cloud. My affiliate link for that is http://askwpgirl.com/go/backupbuddy.php

      I hope that helps. It really does depend on how your hosting and DNS is setup, but most of the time hosts are good about helping this sort of re-pointing of sites.

  77. Hi again (I wrote a comment few hours earlier),
    I finally found what my problem was and thought maybe it will help others, who may also overlook this detail:
    In my WP theme (written by myself) the header in theme index.php was called with

    so I changed it to reflect the directory change to

    Thanks for your article again, good luck!

    • Good point. I’ll add that to my FAQs. Sometimes people who write their own themes hard code URLs in the header which can cause problems. If you code your own themes, you should use the bloginfo template tag and use the parameter “stylesheet_directory” to reference the URLs correctly no matter what domain or directory the theme is in. This is how all of the themes on WordPress.org are coded as well as premium themes. For more information, read: http://codex.wordpress.org/Function_Reference/bloginfo

      • Yeah, I better use stylesheet_directory in themes.
        That php code that I pasted to the comment box, unfortunately, didn’t display. BTW, excuse me for not keeping my comments in a single thread :) (delete them if necessary).
        Good luck!

  78. Thanks for reply!
    After trying to move my WP to the root the home page was just a blank white screen. Since I checked and double checked and redid all the steps – I thought that the problem was that my old static pages are in the root. But now I realise that they are not the problem – since I deleted them all and still have white screen instead of homepage.
    Don’t even know what the reason can be since I triple checked eveything. Will try to work it out.

  79. Thanks for the detailed instructions WPGirl!

    Wanted to ask if it possible to leave old static html pages in the root, instead of deleting them all (deleting just index.html to free the space for index.php doesn’t help). If I want to leave old htmls as they are
    on the site – is there an easy solution (probably involving .htaccess)
    to avoid this WP’s “index.php” and static htmls conflict? Or is it just
    easier to move all old htmls to a folder and make redirects to them from
    old locations?

    • You can leave the old HTML in the root as long as they don’t have the same names as any of the pages on the WordPress site. For example, about.html will get confused with the same page called “about” in WordPress. So perhaps have the URL for the WordPress page be “about-us” instead. However, keep in mind that if the content is the SAME on these pages, you will get docked by Google for duplicate content. So if the purpose of the html pages is to refer to them but not to have them indexed by Google, it is better to put them in a separate folder. Then create a robots.txt file in the root that contains text to exclude this folder from search engine searching. Here’s a sample robots.txt file for WordPress:
      http://codex.wordpress.org/Search_Engine_Optimization_for_WordPress#Robots.txt_Optimization

        • Yes, if you copy the old HTML to a folder, you can view the old site via the browser using the folder name in the URL, eg. http://mysite.com/oldsite/index.html

          However, you will want to use a robots.txt file to block Google from indexing the contents of that folder, so you don’t get deprecated for having duplicate content (any content that is similar or the same between the old site or new site) and to have people inadvertently visit the old site via a Google search.

  80. Thanks for this tutorial I think it saved me a ton of time. I’m moving a site from a subdir to the root to replace the static html site. Everything works except, and I have the WP set for static front page and posts appearing on blog, when I go to blog there is nothing there. 
    All the other internal pages work. So I’m wondering if this method will only work for a blog per say as opposed to creating a whole site with a blog section?

    • Hi Paul,

      Everything is there. If your link to your blog is not working then you might have created a custom link to that in your Menu and need to fix that to go to the http://site.com/blog rather than http://site.com/subdirectory/blog. Also, is the word “blog” the same name as your subdirectory? You don’t want to have any pages with the same name as the subdirectory — that could cause some confusion for WP and it won’t be able to figure what the heck you’re trying to find. You definitely do NOT need to create a whole new site for the blog section. Again, this is an error of either having the wrong link in your menu or using the same name for that page as your subdirectory name.

      • OK, I knew I missed something. I just renamed to “blog” section, as that was the name of the old dir to “articles” and all is right with the world now. Thanks for the memory jog. 😉

        • WordPress runs a query on the database to find out if the URL being submitted via the browser is a post, category, page, etc. But, the server folders are also considered, so when the names are duplicated, it can result in a 404 not found, because it just can’t make sense of what you’re looking for. I’m glad that was the answer!

  81. I just want to thank you for your tutorial which saved the day for me. I followed the WordPress codex but was confused with the inconsistent wording between the general setting tab and the database tables. I was able to correct the site url in the database table to the WordPress subdirectory to fix my error. You saved me a ton of research and headache. 

    You have a wonderful source of great information here – thanks!

  82. Excellent write-up, easy to follow, thank you.
    One question, I have Suffusion Theme, have migrated the website into the root, and the new location displays fine in IE, but in Chrome, Firefox, Opera, it doesn’t show the top image and some other tweaked Suffusion options. Any suggestions? http://filbergfestival.com

    • The change of the URLs to the root shouldn’t effect any of these things. I don’t see any images missing in the HTML. Did you do anything else besides what’s written in these instructions? I haven’t experienced any themes having issues with this process because WordPress is not moved and only the page URLs are writing from the root. Do you have a screenshot you can email to me of what it’s supposed to look like? Your nextgen gallery slideshow is not loading, either, and that is not related to the “move” but perhaps to something else you may have done in addition to what I wrote.

  83. OMG, you saved my rear one more time, askwpgirl! I did a silly thing with my site URL (long story) and broke the whole mess. I looked at your FAQ and, sure enough, you walked me through PHPMyAdmin. Fixed. Wow. I’m so impressed with how well you’ve written these posts.

  84. Hi! Thanks so much for getting back to me. Yes, I’m unable to log into the WP Dashboard. I tried putting everything back, and its still an unformatted mess.  I’ll email you directly. Your site is such a find in the quagmire of WP. Kudos on a great job! Talk soon :)

  85. Hi I had the same issue as Murray (posted 5 months ago) and wanted to know how it was resolved. I followed your directions semi-successfully (:)) moved mydomain.com/main to mydomain.com but all the formatting is gone.  I tried to log into  WP and it gives me the broken formatting as well but then
    it doesn’t go past the main screen –I took a look at the URL and

    http://mydomain.com/main/wp-login.php redirects to http://mydomain.com/wp-login.php and there’s nothing there. So I’m unable to get to the WP Dashboard.I’ve double checked in php Admin wp-options and everything is correct and my .htaccess file seems to be ok too:
    RewriteEngine OnRewriteBase /RewriteRule ^index.php$ – [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ./index.php [L]

    I go the the site and the pretty permalinks are correct (i.e. use mydomain.com/prettypermalink) but 404 errors are loading. I know I’m missing something obvious don’t see what.  Thanks so much in advance! 

    • Hi,

      I don’t see any comment from Murray 5 months ago, so I’m not sure how that was resolved. Please check this FAQ for the information on how to check your settings in the wp_options table in the database via phpMyAdmin. Be sure to check the index.php file you moved to the root per this FAQ and make sure the text you edited is EXACTLY correct. You can email me via my contact form with the website URL. You should be logging in via mydomain.com/subdirectoryname/wp-admin.

    • Ah! Found Murray’s comment — his .htaccess was messed up, but that just made is permalinks not work, it didn’t effect his ability to login to the site. You should login if you can and click Save Changes in the Settings >Permalinks page. Not clear to me if you’re able to login to the WP dashboard or not, so let me know!

  86. Thank you very much for your initial post and all the follow up you have done. In my case everything worked smoothly except that my website now prompts a login to the visitor. :(

    Its something like http://www.mywebsite:80 requires login. 

    I can log on using admin credentials, but this is a public page, no login needed. I have not seen anywhere you have addresses such issue, please help if possible.

    • Hi,

      I sent you an email to follow up. Are you on a Windows or Apache server? Can you check the contents of your root of the website (ie the www or public_html or httpdocs folder) and be sure that there are no other files in there that might be interfering with the WordPress index.php file? Sometimes people have their old sites files in there or some other odd files that might be redirecting the visitor to the site. Also, check the contents of your .htaccess file in both the root and subdirectory. Perhaps email me the contents of the .htaccess file. It’s possible that the root directory .htaccess file has a redirect in it. I notice some problems when people previously had other software installed in the root directory that had written to the .htaccess file in the root, so that it messes things up for you. You should only have the following in the .htaccess files in the root and subdirectory (though the subdirectory .htaccess is usually optional):

      # BEGIN WordPress

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

      # END WordPress

      See http://codex.wordpress.org/Using_Permalinks#Creating_and_editing_.28.htaccess.29 for more info.

  87. Thank you for giving us these explainations, however, I can not find my issue (r perhaps I just don’t know where to look). I moved my WP site from a subdir to root, and everything I new to change, was changed.  Now, the post thumbail is a broken link, and when I look at the code, it’s adding an additional / to the string ( for example: /home/servername/siteurl//wp-content/uploads/2012…)  How and where can I fix this.

    • According to my instructions, you should NOT MOVE WordPress from subdirectory to root. You should ONLY move the index.php file NOT all of the WordPress files.

      You also may have made an ERROR in your General Settings and put a FORWARD SLASH / AFTER THE URL in the General Settings, and that will cause two slashes/ to appear and break everything. So, you can contact me via my Contact form and send me screenshots after I reply to see what you have in your General Settings and where you put all your files.

    • When you install your sitemap plugin, just as with ALL of your other pages, the sitemap.xml file will display from the root. There is nothing you need to do special about this because ALL pages and ALL posts will display from the root per the General Settings of the SiteURL. I recommend the Google XML Sitemaps plugin.

  88. Great site:-) Some of the most straight forward wordpress advice I’ve seen. 
     Just a quick question, I just moved the index.php file from the wordpress directory to the main directory. I did all the steps you adviced. Now the page opens all messed up and I can’t log in to my admin area… The only thing I could imagine something went wrong would be the general settings, as instead of the error message I got just a blank page… Now here is the problem: my web provider is Gate.com and they only say that the phpMyAdmin is going to be available in the future… Any ideas? Thanks

    • When you go to the home page, if you did everything correct, the site should come up. Keep in mind you still need to login to your site via the subdirectory. Please email me your index.php file via my contact form and give me your site URL.

    • Hi,

      Same problem! I am pretty sure that I just changed the WordPress URL instead of the Site URL, but I use GoDaddy for hosting and I have no idea how to find the options panel you describe!

      • The key was to change the Site URL, not the WordPress URL. So, maybe that’s the problem. On GoDaddy, go to My Account, then click Web Hosting and click the LAUNCH button. This will take you to your Hosting Control Center aka Hosting Dashboard. From here, you can click the FTP File Manager button and open the wp-config.php file for your WordPress installation (in the subdirectory where you installed WordPress) to get the database username and password.

        Then, from the green tab at the top called Databases choose MySQL. You will see the name of your database, and you will want click the Manage via phpMyAdmin link. Then per this FAQ I wrote you can make sure the site_url and home url are correctly. Unfortunately the database field names don’t correspond to the field labels in the WordPress General Settings, so it’s a bit confusing, but look at my screenshots carefully and verify that everything is okay. Let me know then if you can login to WordPress. You will login at your subdirectory URL always since that’s where the application still resides. Also, are you on Windows or Linux hosting at GoDaddy? Someone who wrote to me on this blog had a heck of time doing this process with Windows hosting, so we got her switched to Linux.

  89. Hello, Angela.

    I have a problem that is not described in this FAQ. basically, in my case, instead of not being able to view pretty permalink pages, I cannot view the home page. The home page keeps appearing in the subdirectory where the WordPress files are placed, rather than in the root directory. The site I am talking about is is http://freebirdgames.com. You will see that trying to load that page gives you either a blank page or a 500 error. Now, if you go to the WordPress subdirectory, the home page will load there just fine.

    I have verified that the .htaccess file and index.php files have the right code/settings in them. My confusion comes from slightly different instructions in the WordPress Codex page regarding this process. That page, if I read correctly, instructs me to copy, not move, both index.php and .htacces files into the root directory, and leave the originals where they are, THEN modify the index.php file in root. I did everything as instructed, and here I keep having this problem. I don’t know where I failed.

    Do you know what could be causing this? I am using the redirection and Super WP-Cache plugins, but even after being deactivated, the problem persists.

    Thank you in advance.

    • Hi,

      So, right now, you do NOT have the index.php file per the instructions in the root (aka www or public_html) directory of the site, so you did not follow the instructions. Please follow the instructions for moving and modifying the index.php first. Don’t COPY the index.php file but MOVE it to the root directory and modify it correctly, and modify your general settings. Turn OFF redirection plugin and Super Cache. Those can both definitely screw things up during this process. I’ll add that to the FAQ.

      • Hello,

        After I left that message to you here, I had to revert the site to its old version, because I couldn’t leave it like like that. However, I DID have the index.php edited as instructed both here and at the WordPress codex article. I changed the include’s path to point to the subdirectory where my WP installation was.

        Now, today I tried this again, this time only moving index.php to the root and editing, and making the necessary change in the database to make sure that the Site’s address was freebirdgames.com, and the WordPress address was left intact.

        I didn’t move anything else.

        I also made sure that the WordPress Super Cache and Redirection plugins were deactivated before starting the process. And after moving the file and doing all of that, I went into the permalinks page and updated it.

        Everything, to no avail. This time it was worse, however, since I could not load ANY pages at all: not the home page, not the interior pages. I could only access the admin panel.

        I kept seeing the 500 Internal Error in the home page, but 404 Not Found errors in the other pages.

        I am beginning to wonder if this has something to do with the Web host. The site is hosted on Bluehost. Do you know of any similar cases with sites hosted by Bluehost?

        • Hi Jessica,

          Blue Host never has issues with this. I’m sure it’s just a little typo or mistake. Please email me my contact form, and let’s talk. I can probably help you, and it will likely take about 5 minutes.

          • Hello, Angela.

            Thank you very much for responding. I just resolved the problem. There was a conflicting PHP configuration file in the root, which I hadn’t dared to move before. Once I moved this file away, everything started working. I should have removed that file from the beginning.

            I have been working with WordPress for some time now, and this had never happened to me before. I should have guessed.

            Again, thank you. Your advice and support are very valuable.

          • I had a similar problem where someone deleted their .htaccess file but the .htaccess file called for the php version, and nothing worked. They thought it was this process but it was because they disabled php 5. LOL. I’m glad you figured it out. It’s always something.

  90. First thank you for doing this!!  I ran into a problem though on moving my site from wordpress to startlogic. Just got to step 2 above. Now i cannot login to my wordpress dashboard, i just get page not found.  I cannot find any help.  Hoping you have some.

    • These instructions are for displaying pages for a site via the root URL when WordPress is installed in a subdirectory. It sounds like you are wanting to MOVE WordPress from one subdirectory to another subdirectory, so when you made the changes to the General Settings, you now told WP that it lives somewhere it doesn’t, that’s why you can’t login. If this is not the case, I just want to make sure that you read the ORIGINAL post for this FAQ first and NOT used this FAQ post as a starting point. Please read http://askwpgirl.com/how-do-i-move-wordpress-from-a-subdirectory-to-the-root-directory/ FIRST. The post you are commenting on right now does not contain step-by-step instructions — only answers to frequently asked questions and issues.

      • I believe you are correct.  I went to the moving.  So i changed the wordpress address URL.  Oh no, any idea how i fix this?  or roll it back.  Because i sure can’t find the dashboard anymore.

        • You will need to long into your web host’s control panel and access the database via phpMyAdmin. See the instructions in this post, however, you will want to change the two fields that contain the URL to your site to correct URL including the old subdirectory name. If you need the database username and password, it can be found in your wp-config.php file which you can download via FTP or through the web host’s file manager.

  91. This is an excellent FAQ to go with your tutorial: http://askwpgirl.com/how-do-i-move-wordpress-from-a-subdirectory-to-the-root-directory/?doing_wp_cron

    However, toward the bottom you give the following information:

    “Typically, I will search for <a href=”http://yoursite.com/mywp

    and replace with <a href=”http://yoursite.com/mywp

    then I’ll do another search to make sure I didn’t break any image links with <a href=”http://yoursite.com/wp-content

    and replace with <a href=”http://yoursite.com/mywp/wp-content since the wp-content is and always will be in the mywp (aka the subdirectory)."

    Aren't your "search" and "replace" contents in the first two lines exactly the same, i.e., "<a href=”http://yoursite.com/mywp" effectively not changing anything. Did something get cut accidentally during cut and paste, or is the whole idea to search and replace the same content? Or am I missing the point entirely?

    Thank you again.

  92. You are my savior. Thank you, thank you, thank. After many hours of tinkering with this and a severe break that left a client site down and me freaking out, this helped me put it all back together and get the new site live. Honestly…I am so relieved to have this working and fixed that it’s bringing tears to my eyes. Thank you!!

    • I’m so glad that the FAQ was useful! Yay! After helping people troubleshoot this process many times, I thought it was deserving of an FAQ to deal with frequently-faced-issues. I’m curious about what specifically was the piece that you needed to fix?

      • I followed the WP instructions, which immediately broke everything. (Edit the URL settings, then physically move all files the root (which was not possible because the files were all mysteriously locked and immovable). Thinking I had to archive the old site for it to work, I moved it all into an “old” folder and then it was all completely 404, old and new sites. Then of course, the dashboard is inaccessible too. I had to edit the wp-login and wp-config files to reset the URL. Put it all back and then it took me awhile to realize that DUH, the main page of the old site was default.htm, not index.htm, so once I took that away, the new WP site finally showed up.

        I used your instructions to reset the URLs with the MyPHPadmin thing (via GoDaddy) but my URLs in Dashboard settings still show up as uneditable / grayed out. I think I didn’t quite do something right, but for the moment the site is kind of working, giving me a bit more ease to work out the rest.

        Still trying to figure out a few quirks. When I go to cityfruit.org,
        the new site shows up now, but clicking anything internally puts me back into the
        /newsitetest URLs.  Actually, I’m noticing now in settings that both URLs are both reset to /newtestsite. Hmmm…

        • Yes, unfortunately the instructions on WordPress.org for “moving” WordPress make it so much more complicated and difficult than it needs to be and a total nightmare, because to “move” WordPress from the subdirectory to the root does not require actually “moving” WordPress. Tell me now, where are your WordPress files located? Are they in the root directory or are they in the subdirectory? You want the phpMyAdmin settings (per my FAQ) to show the directory where the WordPress application is currently located. If it’s the root, then both those settings in phpMyAdmin should be set to http://cityfruit.org not the subdirectory. Then, you do need to login to WordPress and go to Settings > Permalinks and click SAVE CHANGES to get the .htaccess file to rewrite itself or you can edit this file via the GoDaddy File Manager (FTP Access) and copy in the text in my FAQ. If you write to me via my Contact form, I can give you more specific instructions depending on what the current situation is. Send me screenshot of your directory, index.php file contents and .htaccess file contents.

          • I guess I didn’t have an .htaccess file!

            I had to make one, which contains this…

            # BEGIN WordPress

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

            # END WordPress

            And things were still very screwed up if I didn’t have default permalinks on, or if I uploaded the webconfig file. Something was amiss. Apparently GoDaddy has some goofy Windows Grid server something or other and I needed this magic code in my web.config file:

            http://wordpress.org/support/topic/godaddy-iis-and-removing-indexphp-in-url?replies=20#post-1507468

            Viola. It instantly all snapped back to normal awesomeness.

            **Thank you WPGirl for your support, for having this very helpful article, and for keeping up with the replies and answering.**  You rock.

            cityfruit.org is now happy and fully live.

          • Oh! When you said you were on GoDaddy, I assumed you were on Linux hosting, which is much preferable for WordPress. Windows hosting, as I wrote in my FAQ can result in issues with “pretty permalinks” and is why you got “page not found.” I will had the link you provided to the FAQ page for people who, God forbid, are hosting GoDaddy Windows server. Ugh. Though, in the .htaccess above not sure why /foo is in the rewrite rule. That technically shouldn’t be there. Anyway, glad it’s all working now!!!

  93. Successfully moved my site yesterday and followed all your other instructions re sitemap plugin, silence is golden etc. etc. ! I also installed All in One SEO and configured as per site instructions.

    But… when I do a search this morning, this is what happens:

    Index of /

    mydomain.com/Index of / .ftpquota · cgi-bin/ · pathways/Ugh! – how do fix this?thanks….jeni

    • Hi Jeni,

      Sorry your comment got caught in my spam filter. It looks like your site is working fine now. Let me know if you have any other questions.

      Angela

      • hiii …
        in my main url corePhp site running and other subdirectory wordpress site running .how we upload in main url ?
        please help me someone…

        • Hi, If you want WP to use the Main URL instead of the corePHP site, you can follow the instructions I wrote for this on this blog post. You would want to delete your corePHP files first.

    • Jeni – thanks for writing to me about your issue with the Google search. This indexing of your root directory happened before you “moved” WordPress to the root. When you did not have anything in the root directory, the Google bots indexed the root of the site, and found these files and indexed what was in the root at that time. Usually, when you don’t have a site up in the root or are in development, you’ll want to install a blank “Silence is Golden” index.php file as described in my post to prevent Google from reading the directory or block the search engine bots with a robots.txt file that disallows all bots. Since there were no other files to prevent Google from indexing your root directory, then you have this problem.

      If you’ve created an XML sitemap using the Google XML Sitemap plugin, go ahead and create a Google Webmaster Tools account and submit your site and sitemap to Google via the Webmaster Tools.

      In a couple weeks, the Google search results should be different.

      You might want to create and/or edit your robots.txt file in the root directory.

      A good default robots.txt file content for WordPress is:

      User-agent: *
      Disallow: /cgi-bin
      Disallow: /wp-admin
      Disallow: /wp-includes
      Disallow: /wp-content/plugins
      Disallow: /wp-content/cache
      Disallow: /wp-content/themes
      Disallow: /trackback
      Disallow: /feed
      Disallow: /comments
      Disallow: /category/*/*
      Disallow: */trackback
      Disallow: */feed
      Disallow: */comments
      Disallow: /*?*
      Disallow: /*?
      Allow: /wp-content/uploads
      # Google Image
      User-agent: Googlebot-Image
      Disallow:
      Allow: /*
      # Google AdSense
      User-agent: Mediapartners-Google*
      Disallow:
      Allow: /*
      # Internet Archiver Wayback Machine
      User-agent: ia_archiver
      Disallow: /
      # digg mirror
      User-agent: duggmirror
      Disallow: /
      Sitemap: http://askwpgirl.com/sitemap.xml

      (substitute your site name in place of mine above)

  94. Thanks a lot for all this help! I could move my wp successfully and the easy way with all this points.
    However I have problems with one page. I use one page for displaying all contents generated (all posts in one page) within the blog but this is the only one page that isn’t accessed any more after moving the wp to root. I make this by configuring that page on settings->reading->posts pages. after reading the post i still cannot figure out how to make it available again. all the posts are accesible.

    Thanks in advice for any help on this.

    • Check how you are linking to this page. The link to this page may still be the old link if you linked to it manually via an internal link or from the Appearance > Menus custom menu.

  95. What would be a reason if I can see my site very well (themes etc) when I am logged into my account but if I am not logged on (e.g. using another web browser), i see a badly formatted web site. 

    I had the same settings as above except that in my host file in Mac, I have set my web host’s IP to my domain as I have not yet transferred my nameservers. I wanted to be able to clean up my current web site first. 

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>