How to: Install WordPress in a sub folder

Wordpress folder
Are you hosting WordPress yourself?

A great new feature is that you’re now able to keep the WordPress core folders and files in a separate sub folder.

The core files are all the WordPress installation files which you never touch or alter. All the other files which you upload, plug-ins, themes and configuration files are kept apart. This helps greatly to reduce the “unclean” mix of files of your installation. And, reduces the risk of deleting files which you should stay away from (the core WordPress installation files).

Another very helpful aspect of this feature is the ability to soft launch / beta test a new WordPress blog in a less prominent way (e.g. yoururl.com/testblog ) and than move it to the main location with the simple procedure below.

To reiterate: You can apply this in two ways, either by starting in a sub directory and than move the blog to the main URL/directory or you did set up your blog under the main URL/directory and want to move the core WordPress files into its own sub directory.

Below you’ll find the complete description from the WordPress codex about giving WordPress its own directory:

  1. Create the new location for the core WordPress files to be stored (we will use /wordpress in our examples). (On linux, use mkdir wordpress from your www directory. You’ll probably want to use “chown apache:apache” on the wordpress directory you created.)
  2. Go to the General panel.
  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
  4. In the box for Blog address (URL): change the address to the root directory’s URL. Example: http://example.com
  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).
  7. Copy the index.php and .htaccess files from the WordPress directory into the root directory of your site (Blog 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.
  8. Open your root directory’s index.php file in a text editor
  9. 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');
  10. Login to the new location. It might now be http://example.com/wordpress/wp-admin/
  11. 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.)

Please feel free to ask questions in the comments section below. I’ll help you to get this set up and working. Thanks!

Read More