Typically, when I install WordPress, I usually install it in the root directory of the website. That is because I prefer not to host too many things under one domain name and I really don’t like overly long URL. Simply put, I like my blogs accessible via URL like http://example.com/ rather than http://example.com/my-wonderful-blog.

Installing WordPress in the root directory of the website is usually not a problem but really soon, I would start to optimize my blog for search engine and usually means, placing files like robots.txt, and sitemap.xml. Add a .htaccess file to support the customize the URL. Then there are files for ownership verification required by services like Yahoo! Site Explorer to help clutter up the root directory even more. That is all fine until one day a new version of WordPress is released and it is time to upgrade (just like TODAY!)
Every time I need to upgrade, I find myself doing a lot of cross referencing to make sure I’m not deleting the wrong files. This time around, when I’m installing WordPress for SandboxBlogger.com, I’ve came across this instruction on the WordPress.org. What a great idea! Basically, this simple guide showed me how to install WordPress in a subdirectory off the root directory of the website yet the URL will still remain as http://www.example.com/. Also, all other files I place in the root directory of the website is still accessible via URL like http://www.example.com/sitemap.xml.

For those interested, here’s how:

  1. Unzip wordpress package in the root of your website. Assuming the root of your website is ~/public_html/, you will now have ~/public_html/wordpress (wordpress unpacks into a subdirectory named wordpress). Move the wordpress directory to another directory name like myblog. I assume you will want to but if you don’t, remember to substitute myblog to the actual directory name you want to use.
  2. Proceed to install WordPress as the installation guide said and use this URL: http://example.com/myblog/wp-admin/install.php. Your blog will now have the following URL http://example.com/myblog/.
  3. Login and go to the Options panel.
  4. In the box for “WordPress address (URL):” you should see http://example.com/myblog/ leave that alone.
  5. In the box for “Blog address (URL):” change the address to the root directory’s URL, like http://example.com/. Click on the picture below to see where in the WordPress Dashboard to make the changes.
  6. Wordpress Dashboard

  7. From the file system, copy index.php from ~/public_html/myblog/index.php to ~/public_html/index.php.
  8. Open the ~/public_html/index.php file in your text editor and change the following line:
    to the following:
  9. If you need to customize your permalink, remember to create your .htaccess file in ~/public_html/.htaccess

Remember to also place all other files that do not belong to WordPress in ~/public_html/. Example files like robots.txt and sitemap.xml.