Hosting WordPress in a subdirectory

July 29th, 2011

If you want to host WordPress in a subdirectory, but still use it as the site for your main domain, there are 2 simple steps.

Change the url in the WordPress Dashboard

Go to Settings: General. In the field where it asks for your WordPress URL include the full path to the directory in which you installed WordPress. For instance if you install WordPress in a directory called givecamp the URL might be something like:

In the field for site address put your domain, i.e.

Changing your URL

Edit your index.php file

Download index.php from the root directory using your favorite FTP or sFTP program. Note: This is a different index.php file than the one in your theme directory. The file will look something like this:

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

Change the line that begins with require to reflect the path to your directory. In our example we would change it from:




Upload the edited file to your root directory.

Share and Enjoy:
  • Twitter
  • Facebook
  • Digg
  • StumbleUpon
  • MySpace
  • LinkedIn

Categories: WordPress Tips

  1. Ha, your the first person I have heard this from. Thank You! I been looking for a straightforward answer to this.

    Comment by John Lorince
    Twitter: @ , — July 30, 2011 @1:11 am

  2. I’m glad you found it useful. A few folks has been asking about this so I figured it would makes sense to do a quick write-up.

    Comment by Heidi Cool
    Twitter: @ , — July 30, 2011 @1:28 am

Leave a comment

RSS feed for comments on this post. | TrackBack URL