Go Back   HostGator Peer Support Forums > Public Forums > Pre-Sales Questions

Notices

Reply
 
Thread Tools
  #1  
Old 10-29-2010, 01:39 PM
Spaddiction Spaddiction is offline
Hatchling Croc
 
Join Date: Oct 2010
Posts: 3
Default Redirect primary domain to subfolder HELP

I've searched for this in the forums, but didn't find a solution that worked.

I'm on a Baby hosting plan and want to host multiple domains on this space:
primarydomain.com
domain2.com
domain3.com

Rather than have my primary domain served from the /public_html/ folder, I want it to be served from this folder: /public_html/primarydomain.com/

And similarly, I want the other add-on domain to be served from their own sub folders:
/public_html/primarydomain.com/
/public_html/domain2.com/
/public_html/domain3.com/

I'm trying to do this using the .htaccess file in /public_html/, and here is what I've tried so far:

Method 1:
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?spaddiction.ca$
RewriteRule ^(/)?$ spaddiction.ca [L]
Straightforward, but the problem is that after redirecting, the URL reads:
http://www.primarydomain.com/primarydomain.com/
Of course, I want it to read:
http://www.primarydomain.com/

Method 2:
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?primarydomain.com$

RewriteCond %{REQUEST_URI} !^/primarydomain.com/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /primarydomain.com/$1

RewriteCond %{HTTP_HOST} ^(www.)?primarydomain.com$
RewriteRule ^(/)?$ primarydomain.com/index.htm [L]
This is getting closer, but it doesn't work. Using this .htaccess, http://primarydomain.com redirects and serves index.htm from the /public_html/primarydomain.com/ folder, and the subfolder name is hidden in the URL, but nothing else is served: no images, no other .htm files, etc.

If I access the site using the IP address and the sub-folder, everything displays fine:
E.g.
http://<server-ip-address>/~username/primarydomain.com/

Any ideas on how to modify the .htaccess to fix these problems?
Reply With Quote
  #2  
Old 10-29-2010, 01:41 PM
Spaddiction Spaddiction is offline
Hatchling Croc
 
Join Date: Oct 2010
Posts: 3
Default Re: Redirect primary domain to subfolder HELP

Sorry, my examples were mixed up. Wherever I wrote spaddiction.ca I meant to write primarydomain.com
Reply With Quote
  #3  
Old 11-13-2010, 06:02 PM
Anatol Anatol is offline
Hatchling Croc
 
Join Date: Nov 2010
Posts: 1
Default Re: Redirect primary domain to subfolder HELP

In your code for method 2 replace % with %
Anatol
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to redirect a subfolder LatinCrib Shared Hosting Support 4 09-10-2010 04:37 PM
addon subfolder redirect simone Shared Hosting Support 1 08-20-2010 05:39 AM
addon subfolder redirect simone Web Hosting Services 0 08-19-2010 05:48 AM
Redirect to subfolder tommo Suggestions 7 01-02-2008 10:02 AM
redirect domain root to www.mydomain.com/subfolder/ marchw Shared Hosting Support 2 07-06-2006 07:03 PM

All times are GMT -5. The time now is 03:06 AM.