Ever wondered how to change the webroot of the web hosting package? Maybe you have two domains mapped to a single web hosting package, but you want both domains to act independently… Well you can with a .htaccess file in your public_html folder. Simply create a blank text file called “.htaccess” (if you don’t already have one) and add the following code:
# first domain
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?yourfirstdomain.com$
RewriteCond %{REQUEST_URI} !^/yourfirstdomain_folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /yourfirstdomain_folder/$1
RewriteCond %{HTTP_HOST} ^(www.)?yourfirstdomain.com$
RewriteRule ^(/)?$ yourfirstdomain_folder/index.php [L]
# second domain
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?yourseconddomain.com$
RewriteCond %{REQUEST_URI} !^/yourseconddomain_folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /yourseconddomain_folder/$1
RewriteCond %{HTTP_HOST} ^(www.)?yourseconddomain.com$
RewriteRule ^(/)?$ yourseconddomain_folder/index.php [L]