Search Our Database

How to Display Your Subfolder URL as the Main Domain in WordPress

Last updated on |
by

Introduction

This article explains how to configure WordPress so that the content from a subfolder (e.g., domain.com/subfolder) is displayed as if it’s hosted on the root domain (e.g. domain.com). This is useful if WordPress is installed in a subfolder, but you want visitors to see content from that folder as if it’s the main site.

 

Prerequisites

  • Access to your WordPress Admin Dashboard.
  • Access to your hosting server’s File Manager or FTP to modify the .htaccess file.
  • Ensure you have a backup of your site before making any changes.

 

1. Log in to your WordPress admin dashboard and navigate to the General tab under Settings.

2. Update the Site URL to your main domain URL. In this example, we changed https://testing.com.my/v2 to https://testing.com.my

3. If you have previously configured a permalink, you may need to update it by go to Permalinks tab Under Settings

4. Copy the index.php and .htaccess files from the v2 subfolder to the main directory, such as www or public_html. If you haven’t set up permalinks, your v2 folder may not have a .htaccess file.

5. Open and edit the index.php file in your public_html directory. You can refer to the accompanying image for clarification. Save the file once you’ve made the necessary changes.4

6. Refresh your website. You should now see the main URL displaying content from your subfolder.

For a more detailed guide, please refer to the WordPress documentation

 

Conclusion

By following these steps, your WordPress site content will display as if it’s hosted on the main domain, even though WordPress is installed in a subfolder. This method is effective and avoids moving your entire WordPress installation to the root directory.

 

Article posted on 22 February 2020 by Louis