Knowledgebase

How to store your WordPress in a subfolder but make the site accessible from the root

Normally, if your WordPress is installed in subfolder called, for example, wordpress on your WordPress hosting account, the site will be accessible at yourdomain.com/wordpress. If the application is installed directly in the public_html folder on your hosting account, the site will be accessible at yourdomain.com. However, it's possible to keep your WordPress files and folders in a subdirectory on your account and still have the frontend of your site accessible at yourdomain.com. Here is what you have to do to make this possible. We'll assume that your WordPress files and folders are in public_html/wordpress on your hosting account, making the URL of the site yourdomain.com/wordpress.

  • Log in to the admin panel of your WordPress and go to Settings menu>General. On the page that opens in the field for WordPress Address (URL) type the URL address corresponding to the location where your WordPress files are stored on your hosting account (e.g. http://yourdomain.com/wordpress). In the field for Site Address (URL) type the URL address that you want people to use to access your site (e.g. http://yourdomain.com). Don't forge to click on the Save Changes button.

  • Copy the files index.php and .htaccess from the subfolder where the WordPress is stored (e.g. public_html/wordpress) and paste them in the root folder on your account (e.g. public_html).

  • Next, you need to edit the copied index.php file (the one in the root public_html folder). In the file find the following line:

require('./wp-blog-header.php');

Change it so that the path points to the file in the subfolder where WordPress is installed (e.g. require('./wordpress/wp-blog-header.php');).

For some more details and screenshots you can also check out the tutorial on storing WordPress in a subfolder and accessing it from the root.

Was this answer helpful?

 Print this Article

Also Read