Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using htaccess to change document root [closed]

My website has document root ~/public_html but i want to add all the files into ~/public_html/www

Is there a way to do this with htaccess?

Thank you.

like image 720
keepwalking Avatar asked Nov 14 '11 08:11

keepwalking


People also ask

How do you edit a root document?

Locate the addon domain (or subdomain) you wish to modify. Click the pencil icon next to the current document root for the domain you wish to modify. In the pop-up window, enter the new document root and click Change.

How do I change the root directory?

To navigate into the root directory, use "cd /" To navigate to your home directory, use "cd" or "cd ~" To navigate up one directory level, use "cd .." To navigate to the previous directory (or back), use "cd -"

What can I do with an .htaccess file?

htaccess file is a powerful website file that controls high-level configuration of your website. On servers that run Apache (a web server software), the . htaccess file allows you to make changes to your website's configuration without having to edit server configuration files.


1 Answers

add 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/ RewriteRule (.*) /folder/$1 [L] 
like image 171
Vilva Avatar answered Sep 28 '22 14:09

Vilva