.htaccess file to route www.domain1.com to www.domain2.com/domain1/ ?

fjorner

Senior member
Oct 4, 2000
619
1
0
How do I use an .htaccess file to route www.domain1.com to www.domain2.com/domain1/ ?

I have a subfolder on my primary account called domain1, and I bought domain2, and I want to send domain2.com to the subfolder on domain1.

Alias /domain1.com /domain1

doesn't work if placed in the root of domain2.com. That was my first guess. My hosting company says they writet .htaccess files for their clients but that this is the way to do the job. Damn cryptic frustrations they are!

I am on an Apache/DirectAdmin server. DirectAdmin's domain forwarding service doesn't support forwarding to a subfolder.

Help?
 

fjorner

Senior member
Oct 4, 2000
619
1
0
oddly enough, i had seen that site before but didn't read the comments...


RewriteEngine on
RewriteCond %{HTTP_HOST} alias.com$ [NC]
RewriteCond %{REQUEST_URI} !^/subdir/.*$
RewriteRule ^(.*)$ http://www.original.com/subdir/$1 [R]

what are the [NC] and [R] parts? Are those part of the .htaccess code or some kind of notation from modwest?
 

CaseTragedy

Platinum Member
Oct 24, 2000
2,690
0
0
Originally posted by: fjorner
oddly enough, i had seen that site before but didn't read the comments...


RewriteEngine on
RewriteCond %{HTTP_HOST} alias.com$ [NC]
RewriteCond %{REQUEST_URI} !^/subdir/.*$
RewriteRule ^(.*)$ http://www.original.com/subdir/$1 [R]

what are the [NC] and [R] parts? Are those part of the .htaccess code or some kind of notation from modwest?
they're for the htaccess file. NC = not case-sensitive | R = redirect


-Case
 

fjorner

Senior member
Oct 4, 2000
619
1
0
Okay, that doesn't seem to work.

What does my hosting service need to do? Seems that no matter what I put in my .htaccess file in public_html, I get an Apache 'hey, it worked!' page for domain2.