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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  22. 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 🙂 :).

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

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

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

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

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

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

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

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

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

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

  33. 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: https://askwpgirl.com/go/hostgator.php

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

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

  36. 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: https://askwpgirl.com/go/hostgator.php

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

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

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

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

Leave a Reply

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