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

April 27th, 2010 by admin | Filed under Answers to Your Questions, Installation.

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

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

A. The good news is that you DO NOT need to MOVE WordPress in order to have your content display without the subdirectory name. In fact, installing WordPress in a subdirectory is the preferred by many.

Installing WordPress in a subdirectory is good because:

  1. It keeps your root directory clean and tidy (in case you need to add any other PHP applications to your site).
  2. It adds another layer of security by obscuring the location of your WordPress application files. Ideally, you want to name the subdirectory something not too obvious (ie don’t call it wp or WordPress).

So, go ahead and do all of your testing and development with WordPress installed in the subdirectory. When you’re ready to go live, please follow these detailed step-by-step instructions from Bizquarium.com to simply tell WordPress that you’d like all the files to display from the root directory:

Keeping It Simple: Install WordPress in a Subdirectory

Note: If you are using Cforms contact form plugin for WordPress, you will need to tell the Cforms javascript that Cforms is in a subdirectory. You’ll want to do this BEFORE you activate the Cforms plugin. Hyperarts.com created a good post about how to do this:

Telling Cforms JS that WordPress is installed in a subdirectory


4 Responses to “How do I move WordPress from a subdirectory to the root directory?”

  1. Where were you when I was trying to figure this out a few weeks ago? LOL! Great tips!

  2. admin says:

    LOL. Sorry, Terence, next time, shoot me an email! You know I’ll write a special post just for you :-)

  3. I’ve been developing a site in a subdirectory and we’re ready to go live. The instructions here and on Bizquarium’s site make sense, but my index.php file does not contain that line! I did a search for the line “wp-blog-header.php” in all of my WP files, and it did not appear anywhere! I’m not sure if this is a quirk of the ComicPress theme or what, but I’m not sure what to do.

  4. askwpgirl says:

    Hi Kira,

    The index.php file that needs to be moved and edited is the index.php file that is in the main WordPress application directory. This is at the top level of your WordPress installation. It’s not in the themes folder or any other folder. Please give me a call or email me again if you have questions.

    Also, remember to MOVE this file, don’t copy it. Another note: be sure to edit the General settings exactly as shown on the Bizaquarium site, even if you technically don’t have a “blog,” you’ll need to edit the blog url just as Bizaquarium shows on their post.

    Once you’ve successfully done this once, it’s a piece of cake. One more thing to consider: you may need to go to Settings > Permalinks and click Save to prompt a rewrite of the permalinks to the new location. I’ve only found this to be an issue on GoDaddy hosting. GoDaddy updates it’s mod rewrite once an hour, so you might have to do that and sit back for a bit to see the URLs rewritten to the new root directory correctly. Blue Host, Host Gater, and Host Monster work instantaneously with the updated permalinks.

    Good luck!

    Angela

Leave a Reply