Redirect domain name to a subfolder

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 on
RewriteBase /

# Rewrites all URLS without blog in them
RewriteCond %{REQUEST_URI} !^/store/

# Rewrites all URLs
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.

# Rewrite all those to insert /folder
RewriteRule ^(.*)$ /store/$1 [L]

Redirect “ONLY” the domain’s root URL to subfolder

RewriteEngine on
RewriteCond %{HTTP_HOST} domain\.com [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ /store/$1 [L]
If you have any questions, feel free to open a support ticket or request a live chat with our team!