• Cheap & Best Hosting

How to transfer your main domain to subfolder?

Each hosting account is linked to a primary domain that uses a root directory (folder) where the files are located on your site. And so by the time you decide to arrange your virtual space and organize your files so they can be more easily accessible and discoverable for yourself. It then comes the moment when you need to point your main domain to a specific directory. How to target your main domain to subfolder to find the following lines below

You can transfer your primary domain to subfolder in public_html easily and quickly with just a few action. You can set your primary domain to use a subfolder of your hosting account, you will need to create a redirect. Htaccess file in the public_html folder so that the server can detect and redirect requests to main domain to a sub-folder of public_html.

Visitors to your website will not be able to guess that your main domain using sub-folder, as they will continue to see a website address as http://www.yourdomain.com/page.html.

Redirect. Htaccess main domain to subfolder done by copy and paste the following code in. Htaccess file in the public_html folder of your hosting account. Lines starting with # are explanations about what serves the order behind them.

# Do not change this line.
RewriteEngine on

# Change yourdomain.com to be your main domain.
RewriteCond% {HTTP_HOST} ^ (www.)? Yourmaindomain.com $

# Change ‘subfolder’ to be the folder you will use for your main domain.
RewriteCond% {REQUEST_URI}! ^ / Subfolder /

# Don’t change this line.
RewriteCond% {REQUEST_FILENAME}!-F
RewriteCond% {REQUEST_FILENAME}!-D

# Change ‘subfolder’ to be the folder you will use for your main domain.
RewriteRule ^ (. *) $ / Subfolder / $ 1

# Change yourdomain.com to be your main domain again.
# Change ‘subfolder’ to be the folder you will use for your main domain
# Followed by / then the main file for your site, index.php, index.html, etc.

RewriteCond% {HTTP_HOST} ^ (www.)? Yourmaindomain.co.uk $
RewriteRule ^ (/)? $ Subfolder / index.php [L]

Putting this code. Htaccess file your main domain will be redirected to the desired directory without having any impact on your users! And this is what should look like. Htaccess file can be created in Notepad!

Domain Search