Having a WordPress site show up as the main web site when files are located in a Subdirectory

Let's say ou have a livesite (http://mysite.com) in the main directory of your account (/httpdocs) and have installed a new WordPress site in a subdirectory (http://mysite.com/newsite) and the WordPress files are located in /httpdocs/newsite.

Here is what you'll need to do to have the new WordPress site show up at http://mysite.com :

1- Copy (NOT MOVE!) the index.php and .htaccess files from the WordPress (/httpdocs/newsite) directory into the root directory of your site (/httpdocs). 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.

2- Open your root (/httpdocs/index.php) directory's index.php file in a text editor
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('./newsite/wp-blog-header.php');

3- Login to WordPress as admin and go to the General panel.

4- In the box for WordPress address (URL): if needed, change the address to the new location of your main WordPress core files:
http://mysite.com/newsite.
In the box for Site address (URL): change the address to the root directory's URL: http://mysite.com
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.)

5- After that, your blog should appear at http://mysite.com

Once you have done all that, you can safely delete the old web site files in the httpdocs folder, leaving only the
files needed by WordPress (index.php and .htaccess and the newsite directory).

This procedure is based on a write up on WordPress about that.
See: Giving WordPress Its Own Directory
http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

/Fran


Properties ID: 000235   Views: 1955   Updated: 4 years ago
Filed under: