Many people ask me whether they should install WordPress in a root directory or in a subdirectory. You can do it either way. If your website is built solely by WordPress and you are not very technical, it is better to install it in your root directory. This is also the most popular way to install WordPress.
However, the techie guys may not like it. Their argument is that it is not secure and not organized. They have a good point. So let’s see how to install WordPress in a subdirectory.
Installing WordPress in a subdirectory but having your domain name point to it as if it was installed in the root directory can be a little tricky. Though WordPress.org has an article explaining how to do it, it is hard for beginners to follow. In this blog, I’ll do my best to make it as easy as possible for you to work with.
- Step 1: Install WordPress in a subdirectory. For example, http://www.yourdomain.com/wordpress
- Step 2: Log in to your WordPress back office, go to Settings -> General.
- In the box for Site address (URL): change the address to the root directory’s URL. Example: http://yourdomain.com *** Not WordPress URL***
- Click Save Changes. (Do not worry about the error message and do not try to see your blog at this point! You will probably get a message about file not found.)
- Step 3: Log in to your Hostgator cPanel, go to the “File Manager.” You need to access the root directory of the domain you are working on. As the .htaccess file is invisible, select the checkbox to show hidden files.
- Step 4: Open the subdirectory where WordPress is installed. In my example, it is the “blog” folder. Copy (NOT MOVE!) the index.php and .htaccess files from the subdirectory into the root directory of your site.
- Step 5: Edit your root directory’s index.php.
- Open your root directory’s index.php file in Code Editor.
- Change the line that says: require('./wp-blog-header.php');
to the following using your subdirectory name where WordPress is installed. If your subdirectory is “wordpress”, then you should change this line of code to:
- Save the file.
- Log in to your site, the URL should still be http://yourdomain.com/wordpress/wp-admin/
I find this video tutorial very helpful. Hope you know how to install WordPress in a subdirectory. I will let you decide whether you want to install WordPress in a subdirectory or root directory
Latest posts by Mary Wang (see all)
- 5 Best Sites to Find Free Images for Your Blog - December 9, 2014
- Aweber Vs. GetResponse: Which One You Should Choose - November 15, 2014
- The Amazing WELCOME System - October 20, 2014