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:


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


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. – and all of your images on the site will still be located in the

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


# 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]

# END WordPress

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: If you are on GoDaddy and have Windows hosting, please read:

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:


AddHandler application/x-httpd-php5s .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 and now it is, 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:


// Silence is golden.


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

and replace with <a href=”

then I’ll do another search to make sure I didn’t break any image links with <a href=”

and replace with <a href=” 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. [* Shield plugin marked this comment as “0”. Reason: Human SPAM filter found “_htm” in “comment_content” *]
    Thank you for all the instructions, but I am afraid this did not work for me. After following all instructions, the website would not display at all at my root domain address (just an error message) and at mydomain/subdir the heading would still display, but any post I clicked on would bring an error message.

    I was careful to follow the instructions and check it all several times. Let me just ask you everything I can think of to see what might have gone wrong.

    1) Before doing any of this, I had previously changed the permalink structure a couple of times before settling on the path I wanted.
    2) I copied both the index and the htaccess files, and I changed the line of code in the index file. I also left copies as they were in the subdirectory.

    3) You say above: “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.” Do you mean what I described above? .. that you will still be able to log in at domain/subdir only, but that the individual pages will not display there? Or do you mean that something should display at domain address without subdirectory?

    If the former, that sounds like me, in which case you are suggesting a problem with the host and htaccess file. But I moved the htaccess file, and I seem to be able to rewrite it already with permalink saving, but it does not change anything. Nothing works at

    Any ideas? What way should I turn?

    • Hi Sam,

      Please contact me via my Contact form at and I can help you.

      If you are getting the 404 error on pages, then that is related to your .htaccess, and you need to go to Settings > Permalinks and resave your permalinks settings.

      What URL are they going to when you get the 404 not found message? Is it the new URL or the old URL? If it’s the old URL, perhaps your menu items had custom links. If you go to Pages > All Pages in the Dashboard and click a page to View it, do you still get the error? Do you get the 404 error when you set the permalinks to default?

      Write to me privately, and we will try to figure this out.

      The only other issue that can come up is when a host forces a domain forward to a subdirectory install. This is the case with Network Solutions and a few others. In those cases, you have to login to the hosting control panel and go to the place where the WordPress install details are located and make sure it’s not pointing to the subdirectory. I have screenshots I can send you for Network Solutions if that’s the case.


  2. Hi,

    This is a great walk thru and very much appreciated.

    I have built a new site for client on subdirectory (not subdomain) called “new”. I followed your instructions to the “t”. Well pretty sure or I would not be writing this to find out what went wrong.

    I moved the index file to the domain root as instructed and changed the settings of the file to direct to the subfolder as instructed. I changed the settings in General area to reflect the new display.

    No caching on this site to turn off at this point.

    Once I have done all the steps I go and load the domain (original) and I get a blank page. I fiddled with the settings on the index.php file and no change occurs so I went back to the one from your tutorial.

    When I try to go to the site over on the “new” folder I get error messages and nothing shows up.

    So I am wondering what might have gone wrong as this seems to be a nice and easy procedure. I did clear out the main domain directory of existing files by putting them in a temp folder so they would not conflict. Hosting is Hostgator.

    Thanks for your time

    • What happens often for people is that they make some sort of typo in this process. Often, they have a curly quote instead of a straight quote in their index.php file. So check your index.php file carefully in the File Manager and make sure the quotes are straight single quotes and do not look at all curly.

      Who is your web host? Some web hosts like NetworkSolutions do a redirect on the site when it is installed in a subdirectory, and this needs to be removed.

    • Yes, this is why I have instructions for people to go to Settings > Permalinks and click Save Changes as that rewrites the permalinks. Perhaps you missed that step in the original instructions. To view the .htaccess file, you can look at your files in the File Manager of the website and make sure to show Invisibles. If you are using Filezilla or other FTP program, you will need to set the preferences to show invisible files. You only need one .htaccess file in the public_html folder for this.

  3. Hi Angela! I’m building a site for a client- started it on a sub domain( and using your instructions, successfully changed it to display on the main domain- ( All look good except for the little arrows and social media icons in the footer- ugh! I’ve been trying lots of things (velvet blues update urls)….which I think messed things up in my php admin:( So, I went in and seem to be back to where I started. Do you have any idea how I might fix those little details? Any help would be SO appreciated!

    • Moving from subdomain to root directory is different than moving from subdirectory to root directory.

      With a subdomain, it might be easiest to use the Duplicator plugin and the restore the Duplicator archive in the root directory. You will want to create a new, fresh database for this process using the MySQL Wizard in your web hosting control panel. It’s pretty easy to do that.

      Duplicator has great instructions and video here:

      I’ll write a tutorial soon on migrating from subdomain to root directory, since it is a bit different than the other processes I’ve outlined.

  4. Your article is saving my time. I have read all the comments but seem like no one found the same my issue so I have to leave the comment to asking you directly.

    After I have followed step from you guideline:
    1. Home page’s URL still having “WordPress folder” name while the other pages are no problem.
    2. Before doing this step, permalink was working well but now it needs to set the “default” only unless homepage will be shown the page not found while other pages can be displayed as usual.
    3. I did the blank page for index.php (wp folder). It will be shown a white page if I try to do custom permalink.

    I do have no idea how to fix it. Please guide me.

    • The Home page link is often set in the menu under Appearance > Menus, so you need to manually change that.

      You can have a copy of the same index.php file that is in the public_html folder in the subfolder that wp is installed in and it will be fine.

      Let me know if you have a hard time finding your Home page link in the menus!

  5. Hi Angela,

    Thanks for all the great content! This is my first wordpress website and I had a hard time migrating it from a subdirectory to the root but it mostly worked. I said mostly because now there are some icons that don’t display properly, namely the arrows in the slider, the up arrow to the right hand corner and the 3 icons in the counter .

    I installed wordpress at and now I moved it to Could you help me fix this?

    Thanks again!


    • Hi Nico,

      Did you get this problem worked out? Sometimes it’s a browser caching issue. Also, this can be more of a migration issue, and you might want to run the Velvet Blue Update URLs plugin to rewrite the URLs from the old URL to the new one. Feel free to PM me at angela [at]


  6. Hi,

    I did all of these, yet I can still go to wp-admin and change permalinks. The site loads but it is distorted and just show the texts, it seems no image and css and theme loads correctly.

    I have to mention this that a while ago I accidentally moved the worpredd folder but after bringing it back it didn’t work so I had to put define into wp-config.php

    Maybe this is because of that? Any solution?


    • Hi Shabab,

      Thanks for writing, and I sent you a private email to see if I can help you directly. It sounds like after our back and forth that there is something odd interfering with the site.


  7. Hi, I have built a website in a sub directory and just wanted to check with you before I did the move if having a SSL installed will affect anything. The website is secured with a https://
    Do I need to make any changes to the .htaccess file or just follow your instructions as per normal.
    Thanks in advance for your advice.

    • Hi Sara,

      Sorry for the delayed response. I was traveling when you wrote. The SSL applies to the domain which includes the subdirectory, so it should work just fine whether the site is in the subdirectory or the main directory. You would have issues if the SSL was for only a subdomain as the subdomain SSL would not necessarily apply to the main domain, depending on the type of certificate installed.

      At any rate, just make sure to include the https in the rewrite rule, so it has https instead of http in step 10.

      Let me know how it goes!


  8. Hi Angela!

    How are you doing? I am managing a very successful blog and after two years I’ve decided to made the change from to, following your process. I’ve done it step by step (copying .htaccess and index.php to the root, changing the “site URL” to the new one and changing the line inside index.php) and everything works perfectly: even all the old URLs are working fine and directly redirecting to the new ones. The thing is that I haven’t done any 301 redirects, so I don’t understand why are the old URLs are automatically redirecting. And the question is: if everything is doing fine, I don’t have to do any manual redirect or something more to assure that SEO of the old URLs is not lost? Thanks for your help!

    • Hi Fabio,

      I looked at your site, and I didn’t find any URLs with blog in the URL, but I did see a bunch with wordpress in the URL that were indexed by Google, and those seem to be redirecting okay the root URL. I checked blog as well, and those are redirect fine, too.

      It does seem the 301 redirects are working on the old wordpress URLs.

      As long as the pages redirect from the old URLs to the new ones, you are good. You can check the 301 redirects here:


      • Soorry, it was /wordpress, not /blog 🙂

        yeah, I made the change yesterday, so Google is still indexing the old ones. It’s weird, as I didn’t do any redirect, it just did it automatically?

        Thanks for your answer, I feel more at easy now 🙂

        • Oh good for you!

          Yes, those pages will continue to show in Google for a few weeks until Google recrawls your site. I would submit the new site to Google Search Console and submit a new sitemap.

          Sometimes, WordPress is able to “figure out” the correct web page when given one that is incorrect, that’s why 301 redirects aren’t always needed. WP will maintain the integrity of all links within the site where possible. So perhaps since your URL contained the word “wordpress” and “blog”, it figured it out on its own.

          As long as it is working and they are definitely 301 and not 302 redirects, you are good for your page rank being transferred to the new URLs.

          Here’s info on how to submit the new sitemap:

    • It looks like you have the site in a subdomain rather than a subdirectory. This is a bit of a different process than the one you followed in my blog post.

      If this is the primary domain on the hosting account, you will want to make sure it is in the public_html folder and not in the directory created for the subdomain.

      First, change your General Settings to use the main domain for BOTH URLs with no forward slash at the end:

      If the WordPress files are in a subdirectory right now, they probably need to be moved to the public_html folder. Then, you should see everything okay. Right now, a lot of your assets are trying to load from the subdomain (view page source in your browser), and that’s why the fonts, icons, etc. are all messed up.

      Without seeing your specific configuration, it’s hard for me to advise you with 100% certainty. If these recommendations don’t help you solve the problem, you can contact me for hourly consulting help. I charge $90/hour and bill in 1/2 hour increment. I can usually find the problem quickly.

  9. Hi

    These are the best instructions I have seen on the web.

    Despite the great instructions I have an issue, I can log into the dashboard and part of the site displays (header footer etc) but i’m still getting an 404 not found for content.

    I have done the re-saving of permalinks but this has not done anything, I have also moved the .htaccess file to the root folder and this hasn’t helped either.

    Any ideas?

  10. Thank you, this helped a lot.. Lost the ability to upload images using NextGen though, it looks like a server issue. If I leave the index.php in the subdirectory no probs but when I change it, the system is not happy.

    But thanks.

    • Hi Marius,

      I haven’t experienced that issue with NextGEN. The only thing I could recommend is to be sure to entirely delete your browser cache. Let me know if the NextGEN Gallery persists. I teach a NextGEN Gallery class and have access to folks at Photocrati if it’s an issue we have a hard time resolving.

      You should always leave a copy of the index.php file in the subdirectory to prevent directory viewing. I usually put a copy of the index.php file in the public_html folder and edit the copy there rather than remove it from the subdirectory.

  11. hello im so glad i found your case was moving from a subdomain at to just
    i had problems with my ftp client so i just copied the index.php and edited it.
    also changed the links at general settings but wordpress seems to override my new links..the site can be accessed now at the root domain but the subdomain links keep showing up and my contact forms stopped a lil bit lost here ..your help will be appreciated

    • Hi Mario,

      What you were doing is actually “migrating” the site from a subdomain to a root install.

      You will need to change the General Settings to have the root domain in both URL fields — aka

      Then you need to move all the files to the public_html folder if they are currently in a subfolder in the hosting directing.

      After you move the files, login to WordPress and run the Velvet Blue URLs plugin to update all the URLs on the site rom the old subdomain URL to the new domain URL. That should fix all your issues. The index.php file should then not have the subdirectory in the require line. It should be as it was originally.

      Let me know how that works for you!

      I will probably write a blog post on this process soon.


  12. Hi, Angela!

    You have no idea how empowering it is to find a WOMAN talking about WP. I have learned (and I am still learning) WP the way you did: with hard work and by trial and error 🙂 It’s the best way I learn and I am so inspired to continue to do so after finding your blog. I am stuck, however, with an issue I’ve had for over two months and I have reached a dead end, Hopefully you can help me.

    I am an e-learning designer and my current project is designing an e-learning platform on WP. We chose a theme that is designed for building e-learning experiences, and with it come a lot of embedded plugins to make it work. Everything works beautifully, with the exception of one particular custom post that is used to create assignments in which students are to upload files and leave a comment with their assignment. The issue was that this particular custom post sometimes displayed and it sometimes did not. When it did, it did not allow for the comment to be posted (and entering a comment is required by the design of this post in order for the upload to be accepted). After months of going back and forth with the creators of the theme/plugin, the creators told me that the issue is that the custom post results in a 404 error on the site (before, we had a blank page and then realized it was blank because we had no 404 template).

    So, after going crazy with this, and after testing plugins and themes and all kinds of things to figure out why a 404 was generated when the table, database and file existed, turns out it’s due to the Site URL and WP URL being different. I installed WP in a subdirectory and changed the Site URL to now show the folder, but this causes the assignment custom post to not work. If I leave the Site URL displaying the installation folder, the assignment custom post works like a charm.

    What should I do?

    I want to leave the installation on its own folder to improving security and keep the root folder tidy, but this custom post is ESSENTIAL to the e-learning environment. Right now, all I can do to get the site live is to either leave the installation folder exposed or install in root, and both options are neither very safe nor appealing. All other posts are fine, but this assignment post calls on wp-comments-post.php and that’s when it gets lost. All other comments work (even other custom posts where comments are entered as answers to embedded quizzes), but the assignment custom post does not. I am at a loss.

    Thanks in advance!

    • Hi Gaby,

      Thanks for the great comment! I wonder about women in WordPress a lot. I think WordPress community is much more female friendly than other high tech groups. At least I see a lot of women taking roles in WP. Not nearly as many as men, but I’d like to find a way to highlight their contributions and presence — mostly to help encourage other women that they can do it! It’s more to overcome any cultural stereotypes and discouragement than to say anything about WordPress not supporting women. I think WordPress community is one of the most supportive of all people.

      As for your question, some plugins may be written incorrectly and make calls to the wrong directory. I’ve seen that a handful of times. When this is the case, the subdirectory install when the two URLs are different makes it not work.

      I would say the security benefit is nominal at best. It’s not that much of a security help other than a slight bit of obscurity. Also, keeping the root folder tidy is nice but not necessary. With that in mind, I would recommend you first backup the whole site using something like BackupBuddy or Duplicator plugin. Then, in your Settings > General, change both URLs to the root URL (no trailing forward slash). Then MOVE all the files to the root (aka public_html) directory. Login to your WP Dashboard, and install and run the Velvet Blue URLs plugin to rewrite all the URLs from the subdirectory to the root.

      In other words, I think you have no choice but to run this install from the root, and that’s okay.

      Good luck. Let me know how it goes. If you’re on Twitter or LinkedIn, please connect. 🙂


      • Yes! The WP community as a whole is definitely more open-minded that most other tech communities. I guess my comment came out as an insult to the WP community, and that was not the intention. My intention was to compliment you since, from all the tutorials I’ve read up on to learn about WP, yours is the first one in three years that is written by a woman 😀

        Thanks so much for the suggestion! I was a little bit apprehensive about moving stuff to the root folder, but you’re absolutely correct that there is no 100% safe way to keep your site from being hacked. I did find about 30+ ways to decrease the likelihood of a brute force attack, and I am going to follow your advice and add these other suggestions as well. Thank you again and see you on Twitter/LinkedIn! ^_^

        • Thanks, Gaby! I didn’t take your comment as an insult to the WP Community at all. It is one of the more receptive communities to everyone. Though, I have been to WordCamps and conferences where there were only 15-20% women. I know a lot more women use WordPress but not as many are perhaps writing about it technically or showing up to the WordCamps and conferences. I think it’s nice to highlight some of the women contributors to WP core, plugins, and documentation (whether blogs, books, or on It might inspire other women and younger girls to consider getting into technical fields.

          So, yeah, thanks for noting that! I do think it is notable and not at all insulting to note it. Let me know if you find any other WP technical blogs with women writers. I think has some women writers, and I’d love to collect a list of others.

          Good luck on your website. Keep in mind with security, there’s a lot of advice that is not all that helpful. Over the years, I’ve whittled down my security advice to very simple, best practices:

          1 – Protect your login: Use strong passwords, two-factor authentication, brute-force hack prevention (WordPress Simple Firewall plugin is great for this)

          2 – Keep updated – everything, all the time, immediately.

          3 – Use only well supported themes and plugins.

          4 – Run a tight ship – delete unused stuff, unused WP installs, plugins, themes, etc.

          5 – Run a firewall (WordPress Simple Firewall)

          6 – Backup site

          Numbers 1-4 are critical — you won’t get hacked if you keep things clean and updated. Here’s my security presentation: Please keep in touch.

          • So much good information here! Thanks again! I tried connecting with you on LI. I guess it didn’t go through. I will try again. We actually have Andrea Vahl in common! She’s an awesome lady, too ^_^

  13. Just made a post about about “following the directions to the letter” and getting a blank page. After cutting and pasting code probably too many times, turns out I used one curly quote and one straight quote in index.php require line. Now It works perfectly! Thanks for the straightforward tutorials though!

    • Hi Margaret, I will check my code to make sure it doesn’t have any curly quotes. I think I mention that in my FAQ, so I’ll check that, too. The curly quote issue is common when copying code from the Internet, so I’m always on the look out for that as the first thing to check. Thanks for writing!

  14. You have written the most thorough and easy to understand instructions, yet I still cannot get it to work. I have checked and double checked all possible errors and get a blank screen when I make the following changes. I have checked the PHPMyAdmin panel as well. currently I am using the following in the public_html .htaccess file to redirect to the sub so the page remains active. (I remove it when trying to get it served from the sub) Could it be permalinks? they are set to custom, /index.php/home.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(www.)?$
    RewriteRule ^(/)?$ wordpress [L]

    I have correctly set the general setting URLs:

    the correctly coded index.php in public_html:
    * 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( dirname( __FILE__ ) . ‘/wordpress/wp-blog-header.php' );

    correct .htaccess with in public_html:
    # BEGIN WordPress

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

    # END WordPress

  15. Hi, thanks so much for your great information!

    I successfully installed WP in a directory, and access it from root by copying index.php there and updating the path. All that is smooth with no problems.

    I can login to admin with no problem.

    The problem is that now there is no longer access to the dashboard from my WP pages & posts, through Edit link or the top nav bar.. Now I have to go back to the directory path where wp-admin to make changes.

    Do you have any advice?

    • Hi Chris,

      This is pretty common issue, and the solution is to clear you cookies and browser cache. You can just delete your site’s cookie, and then relogin. Should be fine then.


    • Hi Enzo,

      Thanks for writing. I love Cusco and Peru. One of the most beautiful places in the world.

      The index.php is in your URLs because you might be on a Windows web server. You can avoid this by moving to a Linux-based web host. However, if your site is already running on Apache, it could be the index.php is leftover or entered incorrectly. To fix this, remove the index.php in your Settings > Permalinks and save changes. If this breaks your pages, then contact your web host and send them this page:

      Also, please check your Settings > General and be sure the WordPress URL does NOT end in a forward slash / as that can cause issues on your site. I am seeing two slashes in your WordPress application URLs on your site.

      • thank you so much for your comments and yes Peru and Cusco is great and alot.
        i just came back from a trekk so sorry for the late replying…i will check what you writing tomorrow morning and ill let you know. its running in apache, ill try to remove the index.php but check this some pages have not that (index.php). again Angela.

  16. All works well after following instructions, except that my blog doesn’t behave in the same way that it did before the changes. Now, new posts (for example, 2 test posts I made) only appear as links on the blog page. It used to “compile” new posts one atop another. Any suggestions? Thanks!

  17. Hello!!
    Great tutorial – my website is fine and Dandy;) – but i cannot access my wp-admin area without having to type in wpsite/ – that is the folder where the site has been installed.

    I go there and then i get the 404 error everytime i try and access a page

    I am a bit stumped:(

    • Yes, that is correct. This is because the WordPress application and all the WordPress files are still in the subdirectory, so you will still login via the subdirectory and all uploaded images will have the subdirectory in their URLs.

  18. I finally followed your advice of some time ago and made my site into a WordPress site. Well and good. But now I’m trying to set up a development environment on WAMP. I FTP’d the entire site and copied it into WAMP’s www directory (as below), edited wp-config and the database. But I can only connect to the home page, not to wp-admin and not to any other pages. wp-config contains:
    Tried with and without slash. Matches options in the database.
    Wordpress is in subdirectory wordpress.

    • Hi Scott, We conversed over email. I never define the home and siteurl in the wp-config.php file.

      The best way to set up a local environment from an existing site is by using the Duplicator plugin. It comes with a script that will rewrite all the URLs. You would copy your Packaged site and the Importer file into the directory on your localhost then run the import script by going to http://localhost/water-law/installer.php. You could need to set up a new blank database first. With MAMP the username and password will be root. I’m not sure the case for WAMP.

      I also love DesktopServer app as it takes care of everything for you, including creating the database. It uses XAMP, so you can’t run it at the same time as WAMP.

      You would also use the Duplicator plugin, but then choose the Zip package you downloaded in DesktopServer, and it does all the magic for you.

      Good luck!

      • Thanks, Angela. Actually, I used Backup Buddy and it did the job fine for a few $$. Looks like Duplicator might well have been a better choice, and certainly a better price.

  19. Hi,

    I am getting this error…

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

    What does it mean?

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

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

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

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

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

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

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

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

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

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


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


    thank you

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

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

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

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

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

        • Hi Lucy,

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

  24. Hi Maria,

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

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

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

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

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

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

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

    • Hi Steve,

      You have two periods in your require line:

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

      should be

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

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


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

    Please sir i am waiting for your answer

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

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

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

    • Hi Stuart,

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

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

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

 for example

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

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

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

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

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

  29. Dear Angela,

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

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


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


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

    How would we add wpinstall?



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

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

      • Thanks Angela,

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

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

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

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

        We have tried both and neither seems to work.

        What else should we look at?

        We have a multisite installation.

        Also, could the .htaccess file be an issue?



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

          require( dirname( __FILE__ )

          AND the text string:


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

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

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

    Site is:
    I have the WordPress site at:
    Admin is at:

    Do you need ftp login details?

    Kind Regards,

  31. Hey Angela!

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

    Here are a coupe examples of what the links and backgrounds looked like before the move:

    Any insight you might have will be extremely helpful!

    • Hi Edgar,

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

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

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

      Let me know if you solved your problem or not.



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

      • Hi there, yes I fixed, played around for ages and realised there was a semi colon missing in my index.php… the joys….

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

    • Hi Claude,

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

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

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

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


    • Hi Raj,

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

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

    • Hi Falade,

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

Leave a Reply

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