Changing the Document Root to a sub directory

So you don't want to use the public_html directory for your website. You want to keep it clean and have all of your websites in their own folders. Simply put the following code in your root .htaccess and change your domain instead of domain.com:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteCond %{REQUEST_URI} !domain.com/
RewriteRule (.*) /folder-your-website-is-in/$1 [L]
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What is CPanel?

CPanel is a fully featured web-based control panel that allows you to manage your domain through...

How do I change my contact email address?

Your contact email address is listed in the upper left hand corner of the cPanel main page. Click...

How do I add mail users?

Select Add/Remove E-mail account(s) from the cPanel main page.On the next screen, click Add...

How do I check my webmail in cPanel?

Select Read Webmail from the cPanel main page. Then select a webmail program. If you don't know...

How do I view my account resources (e.g. disk space,bandwidth)?

There are some basic statistics on the left side of the cPanel main page, including total disk...