Go Back   HostGator Peer Support Forums > Public Forums > Suggestions

Notices

Reply
 
Thread Tools
  #1  
Old 11-07-2007, 06:39 AM
hectorix hectorix is offline
Hatchling Croc
 
Join Date: Nov 2007
Posts: 13
Default Change the main domain folder

Hi,
What is the easiest way to change the default folder of my main domain?
I want to run 3 websites on my host in this way:

public_html/1site/content here (main domain)
public_html/2site/content here
public_html/3site/content here

Nice, isnt it?



Now i have something like that:

public_html/content here (main domain)
public_html/2site/content here
public_html/3site/content here

Reply With Quote
  #2  
Old 11-07-2007, 07:27 AM
gtgeorge's Avatar
gtgeorge gtgeorge is offline
Emperor Croc
 
Join Date: Mar 2005
Posts: 2,223
Default Re: Change the main domain folder

Quote:
Originally Posted by hectorix View Post
Hi,
What is the easiest way to change the default folder of my main domain?
I want to run 3 websites on my host in this way:

public_html/1site/content here (main domain)
public_html/2site/content here
public_html/3site/content here

Nice, isnt it?



Now i have something like that:

public_html/content here (main domain)
public_html/2site/content here
public_html/3site/content here

Contact support and ask them to change your document root to the subfolder you wish for your main domain.
__________________
best regards,
George
Reply With Quote
  #3  
Old 11-10-2007, 09:27 AM
hectorix hectorix is offline
Hatchling Croc
 
Join Date: Nov 2007
Posts: 13
Default Re: Change the main domain folder

I found this solution:

The main domain on the hosting account uses the public_html folder for all of its Web site files. Any addon domains use subfolders inside the public_html folder. In order to also set up your main domain to use a subfolder on your hosting account you will need to set up a redirect in the .htaccess file in the public_html folder so that the server knows that any request for your main domain will be redirected to a subfolder on public_html.

Visitors to your Web site will not be able to tell that your main domain is using a subfolder, they will still see the Web site address as http://www.yourdomain.com/page.html

# 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]
Reply With Quote
  #4  
Old 03-02-2008, 03:23 AM
scooter1 scooter1 is offline
Hatchling Croc
 
Join Date: Feb 2008
Posts: 1
Default Re: Change the main domain folder

Thank you Hectorix, this worked perfectly!
Reply With Quote
  #5  
Old 10-29-2010, 12:17 PM
Spaddiction Spaddiction is offline
Hatchling Croc
 
Join Date: Oct 2010
Posts: 3
Default Re: Change the main domain folder

I'm doing the same thing, but this doesn't seem to be working for me.

My primary domain is: spaddiction.ca
I want the files for this domain to be in the /public_html/spaddiction.ca/ folder instead of just in the /public_html/ folder.

Here is what I have in my .htaccess:

Code:
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName spaddiction.ca
AuthUserFile /home/[edited out]/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/[edited out]/public_html/_vti_pvt/service.grp


# .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.)?spaddiction.ca$


# Change 'subfolder' to be the folder you will use for your main domain.

RewriteCond %{REQUEST_URI} !^/spaddiction.ca/

# 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 ^(.*)$ /spaddiction.ca/$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.)?spaddiction.ca$
RewriteRule ^(/)?$ spaddiction.ca/index.htm [L]
This works for the index.htm file, but none of the other htm files and none of the images.

Any idea why?
Reply With Quote
  #6  
Old 11-13-2010, 05:17 PM
davidabraham davidabraham is offline
Hatchling Croc
 
Join Date: Nov 2010
Posts: 2
Default Re: Change the main domain folder

ACTAtek, an access control and time attendance system, that enhances security, accountability and, prevents buddy punching.


__________________________
Unlimited choice of quality used cars available for sale in the UK, for all the best used cars Dealers.
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 12:10 AM.