By default, your primary domain root folder is set as the public_html directory. This is where you can host your live website and upload all the files. However, sometimes you may need to redirect your primary domain to subfolder.
Everyone has access to the root folder, shared hosting users, reseller hosting, VPS hosting, and Dedicated hosting users.
In this tutorial, we will show you the easier way to accomplish this:
1) Login into your cPanel account
2) Choose File Manager under Files
3) Edit the .htaccess file
The examples below can be entered into your .htaccess file exactly as shown.
Redirect “ALL” requests to a domain to subfolder
RewriteEngine onRewriteBase /# Rewrites all URLS without blog in themRewriteCond %{REQUEST_URI} !^/store/# Rewrites all URLsRewriteCond %{HTTP_HOST} ^(www\.)?domain\.# Rewrite all those to insert /folderRewriteRule ^(.*)$ /store/$1 [L]
Redirect “ONLY” the domain’s root URL to subfolder
RewriteEngine onRewriteCond %{HTTP_HOST} domain\.com [NC]RewriteCond %{REQUEST_URI} ^/$RewriteRule ^(.*)$ /store/$1 [L]