PureNews

PureNews is an amazingly sleek and powerful news theme with unlimited color variations.

View full feature list Check out the live demo Buy this theme today

Giving WordPress its’ own directory

Posted by on 3rd Jun 2009 WordPress 5 comments

A lot of WordPress users don’t realize they are able to put WordPress in any folder on their site and still have it use the root domain name for its’ location. This is a basic feature of WordPress that you are able to pull of from the start or after you’ve already installed it. There a few reasons why you might want to do this. It can make things more secure. Moving WP to a location other than your domain’s root is useful if you don’t want people to be able to see your admin area easily. It can also be helpful if you simply want to keep your root folder clear for other things.

If you have installed wordpress in a subdirectory you can make it accessible from the root directory by completing the following steps.

  1. Go to your General Options page. In the box for Blog address (URL) change the address to the root directory’s URL
  2. Click Update Options. (You might get an error message but don’t worry)
  3. Copy the index.php and .htaccess files from the WordPress directory into the root directory of your site.
  4. Open up index.php and find the line that says:
    require('./wp-blog-header.php');
    When you find this, change it to
    require('./wordpress/wp-blog-header.php'); (wordpress being replaced with the name of the directory your WP install is located.

There. Now that was easy, wasn’t it? What if you want to move an already installed version of WordPress into a new directory? This takes a few more steps, but it can still be accomplished without much difficulty.

  • After creating the directory that you want to move WP into, go to your General Options page in wp-admin
  • Change the WordPress URL to the new directory
  • Complete steps 1 and 2 ( ignore errors) and FTP your WordPress files into the new folder
  • Complete steps 3 and 4

There you have it. WordPress should now be safe and sound in the directory of your choice.

Ryan is a full-time freelance writer for hire and WordPress fanatic from Ontario, Canada. When he is not working with words or press he can often be found playing guitar or paying the occassional bit of attention to his ever-so patient girlfriend.

5 comments - Leave a reply
  • Posted by LGR on 3rd Jun 2009

    I do this occasionally for clients and one of the things I have found is some plugins do not like this. I would recommend testing your favourite plugins before doing this because you never know which ones will start to misbehave.

  • Posted by Ryan on 4th Jun 2009

    @LGR – Good point, actually. Testing plugins is important in many situations. Its also worthwhile to mention that this could create potential problems with any pages outside WordPress such as a forum or other script.

  • Posted by eris on 6th Jun 2009

    Very useful. Didn't know this. Thanks

  • Posted by url directory on 11th Jun 2009

    Well, I am happy to tell you, you were completely correct sir

  • Posted by Mida on 30th Jun 2009

    Very nice tip i did not about the change you have to make in the index.php, i thought all you have to do is to change the url from wordpress admin setting page