Here’s the situation:

  1. WordPress has been installed in its own directory (i.e. www.your_domain_name.com/wordpress
  2. You want someone to go to www.your_domain_name.com and go directly to your WordPress installation
  3. A simple redirect will get them there, but the path shown will still be www.your_domain_name/wordpress and you want it to simply show www.your_domain_name.com

WordPress gives directions on “Giving WordPress its Own Directory While Leaving Your Blog in the Root Directory“, but I always initially install WP in its own directory to begin with. Every time I tried to modify their directions and follow them, I’d end up with an error (with maybe one exception). I eventually got so nervous about moving the index to root that I stopped doing it and set up a simple redirect which gave me those ugly subdirectory urls. So, here’s my modified directions that have worked for me.

The following are simply a modification from the WP Codex article “Giving WordPress its Own Directory While Leaving Your Blog in the Root Directory.”

Many people want WordPress to power their site’s root (e.g. http://example.com) but they don’t want all of the WordPress files cluttering up their root directory. WordPress allows you to install the WordPress files to a subdirectory, but have your blog exist in the site root.

WARNING: Multisite users note -This process is not applicable to and does not work if you have enabled MultiSite.

This process will keep WordPress in its own directory and move the index file to the root directory. It may help to print out these instructions before you start:

  1. First do a FULL backup of your website, including databases.
  2. Go to the administration area of WordPress and go to the General panel (under Settings).
    Select General Settings
  3. In the box for WordPress address (URL): change the address to the new location of your main WordPress core files. Example: http://example.com/wordpress (This step is not necessary if WordPress was already in it’s own directory before starting this process, but it’s a good idea to check anyway!).
  4. In the box for Site address (URL): change the address to the root directory’s URL. Example: http://example.com
    Change Site Address
  5. Click Save Changes. (Do not worry about the error message and do not try to see your blog at this point! You will probably get a message about file not found.)
  6. Move your WordPress core files to the new location (WordPress address). Example: http://example.com/wordpress (This step is not necessary if WordPress was already in it’s own directory before starting this process.)
  7. Copy (NOT MOVE!) the index.php and .htaccess files from the WordPress directory into the root directory of your site (Site address). The .htaccess file is invisible, so you may have to set your FTP client to show hidden files. If you are not using pretty permalinks, then you may not have a .htaccess file. If you are running WordPress on a Windows (IIS) server* and are using pretty permalinks, you’ll have a web.config rather than a .htaccess file in your WordPress directory. As stated above, copy (don’t move) the index.php file to your root directory, but MOVE (DON’T COPY) the web.config file to your root directory.
  8. Download your root directory’s index.php file to your machine.
  9. Open your root directory’s index.php file in a text editor
  10. Change the following and save the file. Change the line that says:
    require('./wp-blog-header.php');
    to the following, using your directory name for the WordPress core files:
    require('./wordpress/wp-blog-header.php');
    Update index.php file
  11. Upload your changed index.php file back to the root directory of your site.
  12. Delete any other index files (index.html, index.htm) that are already in your root directory (after you’ve saved a copy of them, of course)
  13. Login to the new location. It should still be be http://example.com/wordpress/wp-admin/
  14. If you have set up Permalinks, go to the Permalinks panel and update your Permalink structure. WordPress will automatically update your .htaccess file if it has the appropriate file permissions. If WordPress can’t write to your .htaccess file, it will display the new rewrite rules to you, which you should manually copy into your .htaccess file (in the same directory as the main index.php file.)

*I have only done this procedure on a Linux server, so I the instructions about a Windows (IIS) server in #7 have not been tested by me.