Edson
Edson

Reputation: 178

how to edit document root of subdomain in bluehost CPanel

Hope someone could help, am new to bluehost and had a shared hosting subscription. Now my issue is how to modify the subdomain document root.

example: from public_html/sub to public_html/sub/public

also when i created a subdomain it doesn't even allow me to add "/" unlike in godaddy

thanks.

Upvotes: 5

Views: 3802

Answers (4)

Justin Russell
Justin Russell

Reputation: 1103

Changing the document root in cPanel worked for me, so it might be worth a try.

  1. Go into the settings for the site you want to change in the Websites area, then click Advanced at the top.
  2. From there, click "Manage" under cPanel, then choose the "Domains" link (or just search for "Domains").
  3. Click "Manage" to the right of the domain (or subdomain) you want to change, and there will be a spot to update the document root on that page.

Best of luck!

Upvotes: 2

markgriggs
markgriggs

Reputation: 11

In order to do this via the Bluehost interface, I followed these steps:

  1. Go to 'My Domains' under 'Domains' in the left-hand column
  2. Click the 'Manage' drop down and choose 'Unassign'
  3. Click the green box that says 'Unassign'
  4. Go to 'Assign' under 'Domains' in the left-hand column
  5. Go to 'Subdomains' under 'Domains' in the left-hand column (If you don't click 'Assign first, then clicking 'Subdomains' takes you to a different page...)
  6. Under the 'Existing Subdomains' header, find the subdomain with the Document Root you want to change and click the red trash can under 'Actions'
  7. Now you can re-assign your domain as an addon or whatever and give it a new Document Root. (I should note, that none of these steps deleted my document root directory).
  8. Go to 'Assign' under 'Domains' in the left-hand column
  9. Follow the steps to assign an existing domain

Upvotes: 0

Wasif Khalil
Wasif Khalil

Reputation: 2247

I had the same issue, some how I landed to this URL https://my.bluehost.com/cgi/dm/subdomain and it allowed to to add "/" with subdomain, hope it helps

enter image description here

Upvotes: 6

Edson
Edson

Reputation: 178

I found a solution so on the root folder add or edit if already existing .htaccess

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

Done

Upvotes: 0

Related Questions