How can I change my document root folder

Description of your first forum.
Post Reply
Isabella
Posts: 10
Joined: Tue Jan 13, 2015 3:02 pm

How can I change my document root folder

Post by Isabella » Tue Jan 13, 2015 3:05 pm

Hi friends, Can I change my document root folder on server using .htaccess file?
Please help me I need of this urgent.

thanks u all in advance.

Ava
Posts: 10
Joined: Mon Jan 19, 2015 3:23 pm

Re: How can I change my document root folder

Post by Ava » Wed Jan 21, 2015 10:59 am

Yes, you can change my document root folder on server using .htaccess file.

Add the following codes to the .htaccess file in the root folder:

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

Hope this help you.

nelsonjulia811
Posts: 11
Joined: Thu Jan 22, 2015 4:16 pm

Re: How can I change my document root folder

Post by nelsonjulia811 » Tue Apr 07, 2015 10:32 am

To change the document root folder:

Log into cPanel.
In the "Domains" section, click the Addon Domains or Sub domains icon, depending on which you'd like to modify.
In the Modify a Domain section at the bottom of the page, click the icon next to the current document root for the domain you wish to modify.
In the popup window, enter the new document root and click Change.

Isabella
Posts: 10
Joined: Tue Jan 13, 2015 3:02 pm

Re: How can I change my document root folder

Post by Isabella » Wed Nov 17, 2021 4:55 am

1. In your public html folder, edit the. htaccess file. See How to Edit Your.htaccess File for more information.
2. Replace example.com and directory with your details at the start of your. htaccess file. RewriteEngine is enabled.
3. Make a backup.

woodevie
Posts: 13
Joined: Thu Jan 22, 2015 4:05 pm

Re: How can I change my document root folder

Post by woodevie » Mon Dec 27, 2021 3:07 am

1. Modify your account's primary domain name, then add the former primary domain as an addon domain. You may choose the root folder for the primary domain/new addon domain this way. (Public html will now be the new principal domain.)
2. Use mod rewrite to redirect users to a new default directory on your website. The URL will include the new folder name (e.g., http://domainname.com/subfolder/).

Post Reply
cron