How to Install the WordPress files to a subdirectory but your blog exist in the site root
- Create the new location for the WordPress files to be stored
For Example : Here we use http://yourdomain.com/wp - Go to General option under “Settings” tab in wordpress admin
- Change the address to the new location of your WordPress files in WordPress address (URL) field
For Example : http://yourdomain.com/wp - Change the address to the root directory’s URL in WordPress address (URL) field
For Example : http://yourdomain.com - Click on Save Changes. You will get a message about file not found but don’t worry about error message & leave it.
- Copy index.php and .htaccess files from the WordPress directory http://yourdomain.com/wp into the root directory http://yourdomain.com of your site
- Open index.php form the root directory http://yourdomain.com in any text editor & change the following.
Change this line
require(‘./wp-blog-header.php’);
to the following
require(‘./wp/wp-blog-header.php’); - Login from the new location which is http://yourdomain.com/wp/wp-admin/
- If you have set up Permalinks, go to the Permalinks option under “Settings” tab 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.

