When installing WordPress to manage your brand new website, you’ve got two choices: either install it to the root directory or install it to a subdirectory.
I’m talking about where the actual files are located. In both cases, you’ll be able to setup your WordPress site so that it works at a location like http://www.yoursite.com/
The Pros and Cons of Subdirectories
There are a couple of major advantages I see to installing WordPress in a subdirectory:
- It keeps your web root folder neat and tidy. If the needs of your website are anything like this one you’ll want the freedom and flexibility to introduce other web applications into the mix without making a big mess of your file structure. Putting WordPress in its own folder tucks almost all of the files associated with it away in a simple and clear location.
- It makes it easy to add an additional layer of security to your admin directory. Well, that is unless you are stupid enough to write about it as I’m doing. The security bonus is accomplished by renaming your WordPress subfolder to something that is hard to guess, making it more difficult to hack into.
Here is how you get it done
First, you are going to want to install your WordPress blog per the standard WordPress instructions. The only difference here is that you’ll want to make a subdirectory to install to instead of installing directly into the root folder of your website. While the natural name for this subfolder would be wordpress or wp I like to make it a little bit harder to guess and make it something a bit more unique. Here at Bizquarium I have used _wp (shhh! Please keep my secret folks!).
Then you are going to want to move (not copy) the index.php file from the main folder of the WordPress install to the root of your website and open up it in a text editor. You’ll need to change the path on line 4 to look like this:

Of course, instead of _wp use whatever super-secret folder name you picked.
Next, you need to login to the WordPress administrator. Remember, that is going to look something like:
http://www.yoursite.com/folder-name-you-picked/wp-admin/
Once you are logged in head over to Options > General and change your WordPress Address (URL) so that it includes the folder name you used. When you are done it should look something like this:

That’s it! You should be all done and ready to really get cooking with WordPress.





2 Comments
Nice one. Cheers for this. So simple, I didn’t realise. I was looking for something more complicated. ha ha
Hi — thanks for the post!
Incidentally, you will have to copy the .htaccess file from your wordpress directory if you want pretty permalinks to work! Cheers!
One Trackback
[…] if you are like me and have WordPress installed in a subdirectory to keep thing clean you’ll need to fix another glitch on lines 279-281 by […]