Q. I’ve installed my website in a subdirectory of our domain, because I didn’t want visitors to see the site until I was finished with our development.
Now I want to have the site show up in the root directory (not in the http://mydomain.com/wordpress directory). How do I do this? I’ve read the information on moving WordPress, and it seems really complicated.
A. The good news is that you DO NOT need to MOVE WordPress in order to have your content display without the subdirectory name. You only need to move 1 file and change one line of code and make one modification to your General Settings, and you’re good to go (see instructions below).
Installing WordPress in a subdirectory is good idea because:
It keeps your root directory clean and tidy (in case you need to add any other PHP applications to your site).
It adds another layer of security by obscuring the location of your WordPress application files. Ideally, you want to name the subdirectory something not too obvious (ie don’t call it wp or WordPress).
It allows you to develop a new WordPress site while maintaining your current website in the root directory. Once you’re finished with your WordPress development, you can backup and then delete your current site’s files, and use the following instructions to display WordPress from the root directory of the site.
“Moving” WordPress from Subdirectory to the Site’s Root Directory
1. Install WordPress as you normally would, but instead of installing it in the root directory (ie in the www or public_html directory), install it in a subdirectory in the www or public_html folder.
2. Once you’ve completed your design work, adding pages to the site, etc., login to the WordPress Dashboard. From the Settings -> General tab, set your WordPress address URL to the subdirectory you installed WordPress in (without the trailing slash). Note: This will already be displayed in the WordPress address field, so you don’t have to change it. What you do need to change is the Site address URL. Set this to your site’s root address (without the trailing slash).
3. Next, MOVE (do not copy) the index.php file that is in the WordPress application directory to the root directory. You can usually do this in an FTP application by selecting the file and choosing Move. (Do not move the index.php file in the themes folder or any other folder.) (Note: If you have a site already in the root directory, such as an old static html site, then you should backup and delete those files first.)
4. In a text or HTML editor, open the index.php file that you just moved and change the location of your wp-blog-header.php to the new location.
Example: if your WordPress installation folder is ‘mywp’, you would change:
< ?php require('./wp-blog-header.php'); ?>
< ?php require('./mywp/wp-blog-header.php'); ?>
5. Visit the site and click an interior page to make sure it displays correctly. If it doesn’t, you may need to update your permalinks (Settings -> Permalinks and click Save Changes). If you still cannot access your interior pages, then the .htaccess may need to be moved to the same location as the index.php file (i.e. the root directory). This is not necessary on all web hosts. Be sure to update the permalinks again after you move the .htaccess file.
Remember that your login and registration links will still be
Now, when people visit your site, they will see all the URLs of all the pages and posts as if you had installed WordPress in the root directory, and you will have a neat WordPress directory behind the scenes.