WordPress Tutorial: Install WordPress In A Different Directory

Teli Adlam —  March 4, 2006

On some of my WordPress installations, usually for larger sites or sites that already have a lot of folders and files, I choose to install WordPress in another directory.

This may be something you may want to consider if you just want to keep things neat and organized on your server.

First things first, back up all of your files before you do anything else.

1. Install WordPress as you normally would, but instead of installing it in the blog’s root directory, install it in the folder you want to use as your back end – like “admin” or “wp”, etc.

2. Once you’ve completed your installation of WordPress, login to the admin panel and from the Options -> General tab, you’ll need to set your WordPress address to the folder you installed WordPress (without the trailing slash) and set the Blog address to your blog’s root address (without the trailing slash).
Set Your WordPress and Blog addresses

3. In a text or HTML editor, open the index.php file and change the location of your wp-blog-header.php to the new location.

Example: if your WordPress installation folder is ‘admin’, <?php require('./wp-blog-header.php'); ?> becomes <?php require('./admin/wp-blog-header.php'); ?>

4. Upload the edited index.php to your blog’s root directory (i.e. not the ‘admin’ folder) and delete the index.php file from your WordPress directory (i.e. the ‘admin’ folder) or set it to redirect to the root.

5. If you’re using permalinks or other rewrite rules, the .htaccess file needs to be in the same location as the index.php file (i.e. not the ‘admin’ folder)

Remember that your login and registration links will change. Where you used to visit http://www.yoursite.com/wp-login.php, the location will now be http://www.yoursite.com/admin/wp-login.php.

People should still be able to visit your blog’s homepage and see everything as they normally would, and you have a neat WordPress folder behind the scenes.

Special Note for WP 2.5+ Users: Some of the nomenclature for the WordPress admin panel has changed. Options has now become Settings.

Teli Adlam


13 responses to WordPress Tutorial: Install WordPress In A Different Directory

  1. Thank you for the information! I was clicking on the wordpress directory everytime I went to my site before boringest directed me to your blog!

    Thank you thank you thank you….

  2. What is the advantage of installing WP in a different directory? wouldn’t it be troublesome when come to access?

    I just want to know what is the advantage? safe fr hacker attack?

  3. A little old I know – but I recently forgot how a problem with my way of doing this and found my way here so I’ll answer Steven’s question, although he’s probably had an answer by now:

    If you’re like me and installed wordpress in a different directory from the root folder but want the blog showing up when people go to your domain (instead of yourdomain.com/wordpress) then that is the advantage of being able to do this ^^

  4. Thanks a lot for sharing this tips to us. I tried it and it worked in right away.
    Thank you!

  5. Good article on this! I’ve already set this up before, but wanted to double-check before doing another install. Very concise, clear…

    This method is great for having static pages in the root of your site, and your blog posts in a different directory.

  6. Thanx for this nice tutorial.
    I did it and it worked great. Just one problem I haven’t figured out yet. I have the Edit-Link () on every page but after moving wordpress to the subdir, it has vanished.

    Do you know a way to make it work?
    Greetings from Germany

  7. Helpful. But i already had a problem with the blog installation in another directory.

    Hope this works

    I wanted it in root directory.

  8. Hii.. I have checked the tip published by you.. but I have a small or may be a big question regarding this. Suppose I have a blog site which is established by me a long time back and some or more SEO has already been done on that website and then after that I implement the things which you described above, then what about those old SEO Links placed with verious websites and search engines..??? will those links work in the same way or will be broken up..?? This question striking in my mind again n again just because you havn’t mentioned the back end process i.e. How wordpress redirecting the links in this process..?? We simply call it a redirection because our installation directory is different than root. Please let me know the answer to my query.

    Thanks in advance.

  9. I followed these instructions but messed up one part. I accidentally changed both WordPress address and url to domain.com now I can’t access the admin panel to fix it.

    Is there another way to change the WordPress address without the admin panel?

  10. thanks for this great tip.
    I am not sure if I am missing anything.
    when index.php is moved to the blog root directory, the file tree in the wp installtion directory is exposed. is this mormal?
    is there something to prevent that?
    for me, I created an empty index.html in the installation directory.
    will thsi be enough?
    Thanks again.

  11. I’d just like to answer stevens question. I put wordpress in a different folder so that when I’m building it nobody will see it, unless people who i shared the link with like clients who want to see the website online before launching it. something like http://www.mywebsite.com/beta . So beta folder is actually wordpress. If I decide to launch this site. I do the instructions here so the site will appear when I type in the url http://www.mywebsite.com.

  12. Prince Ade-Johnson July 11, 2010 at 9:49 am

    Thanks for this. I upgraded my wp blog from 2.7 to 2.9.2 but got a fatal error message after then. So after much effort to restore failed, I decided to install a fresh wp which is now upgraded to version 3.0. But the automatic installation did not allow me to install the new wp in the root directory. It always diplay an error message that I cannot install more than 1 scripts on the root directory. But I don’t have any other installation having deleted
    the remaining files of my former blog.

    I have installed a new one but it is on a folder named blog. When I launch my domain name it shows index page and the folder “blog”. This is not good for my visitors to see. pls can you help to correct this.


  13. @Prince Ade-Johnson: From your blog’s admin panel, you need to change your “Blog address (URL)” to point to your front page, then using FTP, download the index.php file found in the /public_html/blog/ folder and edit the part which says ‘./wp-blog-header.php’ to ‘./blog/wp-blog-header.php’, save and upload that index.php file to your public_html folder.