By default, the web content of your website will be loaded from the public_html directory. 

But if you want to load web contents from a sub-folder, you can implement this by adding the following lines to the .htaccess file in the public_html folder:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain-name.com$
RewriteCond %{REQUEST_URI} !folder-name/
RewriteRule (.*) /folder-name/$1 [L]

Make sure you replace the following two parameters in the above code block:

Step 1: Replace domain-name.com with your actual main domain name.

Step 2:Replace folder-name with your sub-folder name.

Note: This tutorial is only applicable to the Apache web server.

 

→ Are you looking to move WordPress from the root directory to the subdirectory? 

Please refer to the article on how to move WordPress to the subdirectory for more details.

 

Was this answer helpful? 2 Users Found This Useful (3 Votes)