Linking home URL to WordPress installed in a subdirectory

  • 0

I have recently started putting all new wordpress installs into a subdirectory, I found it makes it much better for developing a site (works especially well if a client has an old site that they want to keep running until the new one is ready). It also keeps the root directory clean & tidy.
One thing I did find is that the ‘Using a pre-existing subdirectory install‘ instructions on the WordPress codex site is a little confusing and long winded so I have simplifed the steps here…

1. Once WordPress is installed in a subdirectory for example www.site.com/wpfolder simply create a new index.php file in the root directory and add the following to it:

define(‘WP_USE_THEMES’, true);
require(‘./wpfolder/wp-blog-header.php’);

Obviously change wpfolder to the name of your subdirectory.

2. If not already logged in login to WordPress using the original path with the subfolder ie. www.site.com/wpfolder/wp-admin and goto Settings > General and change the Blog address (URL) to http://www.site.com. DON’T change the WordPress Address (URL)..

3. You will need to copy (not move) the .htaccess file into the root and update your permalinks.

Leave a Reply

Your email address will not be published.