By default, the web contents 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]
Note that the following tutorial is only applicable to the Apache webserver.
Make sure you replace the following two parameters in the above code block –
- Replace domain-name.com with your actual main domain name.
- Replace folder-name with your sub-folder name.
→ Are you looking to move WordPress from the root directory to the sub-directory?
Please refer to the article on how to Move WordPress to the sub-directory for more details.