Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Change Document Root for Main Domain?

  1. #1

    Default Change Document Root for Main Domain?

    Hi,

    just signed on to BH today and already found most of the stuff I could possibly need - happy customer so far For instance I managed to work out how to create Addon domains to point my other domains at various subfolders of my document root. However, what I'd like to do now, and I'm stuck on is...

    Is there any way for me to point my Main Domain (the one associated with my cPanel acct) at a different Document Root other than public_html?

    I have tried searching the forum with no luck, and I have tried stuff like redirects but that's not it either. For those out there asking why on earth would you WANT to do this... I like to be able to version control the contents of each of my sites independently. For instance, if I want to replace a site from source or backup, then I can just overwrite the whole folder and subfolder tree with my master copy. This principle works fine for all my Addon domains, but it would not work for my Main Domain, because all the Addons are SUBFOLDERS so they'd all get overwritten (ouch!). Sorry if that didn't come out in English

    If the answer is "NO!", then would my best bet be to point my other domains into different top level folders (e.g. public_html_domainname)? Would there be any other nasty repercussions of doing this?

    Cheers
    Art

  2. #2
    Early Out's Avatar
    Early Out is offline Former Moderator, Still Respected
    Join Date
    Mar 2006
    Location
    Sector R
    Posts
    4,650

    Default

    You can't move your stuff away from public_html - that's built into Apache, and you're on a shared server, so it can't be altered for one account.

    What you can do, however, is put your main domain stuff into a subfolder under public_html, so that your main domain will look just like your addon domains:

    public_html/example (your main domain)
    public_html/addonexample (an addon domain)
    public_html/subexample (a subdomain)

    From the knowledgebase: http://helpdesk.bluehost.com/kb/inde...article/000347
    Last edited by Early Out; 06-29-2009 at 08:41 PM. Reason: New URL

  3. #3

    Default

    Top answer, Early Out - works like a dream!

    I'll extend my wrist for a gentle slap for not having checked the BH knowledgebase before posting, but lets just say that I'm very happy with my BHForums experience so far too

    Many thanks
    Art

  4. #4
    Join Date
    Oct 2007
    Posts
    43

    Default

    Art (or Early),

    Was that .htaccess listing correct for you? I get a "500" server error. So besides substituting in your real domain name and subfolder as specified, did you have to change any of the syntax to get it to work?

    Thanks,
    Ron

  5. #5
    Early Out's Avatar
    Early Out is offline Former Moderator, Still Respected
    Join Date
    Mar 2006
    Location
    Sector R
    Posts
    4,650

    Default

    I've never done this myself (no need to), so all I can rely on is the knowledgebase article. If that doesn't work, you should probably hook up with Live Chat, and ask them to take a look at what you've got.

  6. #6
    Join Date
    Mar 2009
    Posts
    3

    Default

    Quote Originally Posted by Engineerly View Post
    Was that .htaccess listing correct for you? I get a "500" server error. So besides substituting in your real domain name and subfolder as specified, did you have to change any of the syntax to get it to work?
    Ron,

    I pretty much followed what was shown in the linked posting and it worked a treat for me. Don't forget that you need to substitute your domain twice and your folder thrice (first five lives are for when there is a path specified and the last two for when its just the domain)...

    Code:
    # rule for a specific 'filepathname'
    RewriteCond %{HTTP_HOST} ^(www\.)?myblogdomain\.com$
    # exclude specific calls for the subfolder in question or for files or folders that exist in the root
    RewriteCond %{REQUEST_URI} !^/wordpress/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /wordpress/$1
    
    # rule for the domain root
    RewriteCond %{HTTP_HOST} ^(www\.)?myblogdomain\.com$
    RewriteRule ^(/)?$ wordpress/index.php [L]
    As Early suggests, maybe LiveHelp can help you debug
    Good luck
    Art

  7. #7
    Join Date
    Jun 2007
    Posts
    3

    Default

    Quote Originally Posted by Early Out View Post
    It looks like the format of the knowledge base urls has changed. The new url is http://helpdesk.bluehost.com/kb/inde...article/000347
    Last edited by Early Out; 06-29-2009 at 08:42 PM.

  8. #8
    Early Out's Avatar
    Early Out is offline Former Moderator, Still Respected
    Join Date
    Mar 2006
    Location
    Sector R
    Posts
    4,650

    Default

    Yes, they've thrown me a curve - I've had to fix a couple of older, but often-used posts!

  9. #9
    Join Date
    Apr 2009
    Posts
    2

    Default

    Hi there,

    This worked for my... my main site is now redirected to a folder inside public_html.

    Now there is a question, my site name is "h**p://www(dot)sitename(dot)com" and when I go to the site index.php it is just ok but when I follow some link inside the site it will show "h**p://www(dot)sitename(dot)com/subfolder/link.php".

    Is there a way to remove the subfolder from the path ?

    I am using a Joomla installation.

    Thanks in advance!
    Last edited by pbeleco; 06-28-2009 at 01:23 PM. Reason: Removed link tags

  10. #10

    Default

    So I'm having the same issue as pbeleco, except with a drupal install. Is there a solution to this?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •