View Full Version : /public_html directory change
diangelo
09-23-2008, 11:58 AM
I couldn't find an answer that I had confidence in following pertaining to achieving my goals listed below. Please help.
As you know, primary domain points to /public_html.
Also, subdomains points to /public_html/"subdomain name"
My challenge is:
1. I want to contain my primary domain within a directory under public_html.
primary.com ---> /public_html/primary ... not ---> /public_html
2. I need to rename a directory that a subdomain points to.
domain.com ---> /public_html/dom ... needs to be --> /public_html/domain
I've looked at the cpanel options and either I missed it or it's not there. I wouldn't mind removing a domain, but I am afraid that I will put my domain in limbo if I can't add it back with a revised path.
Let me know your thoughts as I've tried to be very clear in what I want to achieve. I look forward to your comments on this challenge.
diangelo
09-23-2008, 12:27 PM
I found the following in the HostMonster database and it works for solution number 1.
# Hostmonster.com
# .htaccess main domain to subfolder redirect
# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.
# Do not change this line.
RewriteEngine on
# Change yourdomain.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
# Change 'subfolder' to be the folder you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subfolder/
# Don't change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subfolder' to be the folder you will use for your main domain.
RewriteRule ^(.*)$ /subfolder/$1
# Change yourdomain.com to be your main domain again.
# Change 'subfolder' to be the folder you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
RewriteRule ^(/)?$ subfolder/index.php [L]
diangelo
09-23-2008, 05:06 PM
This was a little convulted, but tech support just stated that I had to un-assign the domain. This basically means that I had to:
*Try at your own risk. I am not an expert. Just because it worked for doesn't mean it will for you.
1. Get the add-on domain un-assigned.
(cp-->domain manager-->click "host status" link of domain)
2. Remove the subdomain pointer.
(cp-->subdomains-->click "remove" link of domain)
3.) Assign the add-on domain again.
(cp-->domain manager-->click "addon" link-->go through "addon" wizard.)
4. PAY Attention to what directory you now want this addon domain to be using.
That's it. Wow. I helped myself and you. I think I'll drink now.
Jeff
BernardBarret
01-24-2009, 03:42 AM
hi
Awesome post Lee!
Thanx for the list.
www.staffingpower.com
dmiranda
01-26-2009, 12:49 AM
I have a similar, but perhaps more complicated request: I want to redirect my primary domain to a subfolder within public_html folder.
That is I want to move from a situation where mydomain.org points to public_html, to one wher eit points to public_html\mydomain.
Is that doable?
This was a little convulted, but tech support just stated that I had to un-assign the domain. This basically means that I had to:
*Try at your own risk. I am not an expert. Just because it worked for doesn't mean it will for you.
1. Get the add-on domain un-assigned.
(cp-->domain manager-->click "host status" link of domain)
2. Remove the subdomain pointer.
(cp-->subdomains-->click "remove" link of domain)
3.) Assign the add-on domain again.
(cp-->domain manager-->click "addon" link-->go through "addon" wizard.)
4. PAY Attention to what directory you now want this addon domain to be using.
That's it. Wow. I helped myself and you. I think I'll drink now.
Jeff
pghcollectibles
01-26-2009, 11:31 AM
i think that can only be done with .htaccess when its your main domain name. i cant help you with the code but, as this basic thing has been in other threads, my advice is to search for htaccess with user posts by falcon1986 (http://www.hostmonsterforums.com/search.php?searchid=324194). i know there should be a few.
Falcon1986
01-26-2009, 12:54 PM
Yes, using .htaccess would definitely help in this situation.
After a bit of searching around here (http://forums.site5.com/showthread.php?t=20836) is what I came up with (go to the last post). Place these rules within your .htaccess file as located in your ~/public_html directory.
Remember to replace "domain.com" and "subfolder" with your own information.
Also, remember to place the following statements at the very beginning of your .htaccess file if they haven't already been entered.
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
I have a similar, but perhaps more complicated request: I want to redirect my primary domain to a subfolder within public_html folder.
That is I want to move from a situation where mydomain.org points to public_html, to one wher eit points to public_html\mydomain.
Is that doable?
dmiranda
01-26-2009, 10:00 PM
Thanks. That did it.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.