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. This FAQ is not for the process of physically moving WordPress from the subdirectory to the root but for troubleshooting the process where you change the General Settings and move and edit the index.php file in order to show the URLs for posts and pages from the root without actually having to move WordPress.

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 $95/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]

&lt;?php
// Silence is golden.
?&gt;

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

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

 

Angela Bowman

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

View all posts by Angela Bowman

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

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

      • Hi Angela,
        Although I just posted a comment on your blog about my problem but then I was scrolling through comments and this comment of yours solved my problem. Thanks a lot for this wonderful article and website.
        Your response rate is awesome.

        • Hi Anurag,

          If you have an Under Construction notice, then it is likely you have a plugin installed for Under Construction or still have a default index file left in your root directory.

          Let me know what you find!

          Angela

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  20. 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 https://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.

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

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

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

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

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

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

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

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

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

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

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

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

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

  34. 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 https://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.

  35. This is an excellent FAQ to go with your tutorial: https://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.

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

  37. 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: https://askwpgirl.com/sitemap.xml

      (substitute your site name in place of mine above)

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

  39. 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 *