...

View Full Version : Redirecting sub-domains and specific directories



djm0219
08-13-2011, 06:25 PM
I have a shared hosting account with multiple domains under a single "master" domain. For the purposes of this discussion we'll call the "master" domain xyz.com since the real domain name is rather long.

The additional domains hosted on the account are added as sub-domains of the master domain so a sub-domain named abc.com is added and shows up as abc.xyz.com. The main domains files are in the public_html directory and additional domains fall below that with any name desired. For our abc.com domain its files are found in the public_html/ABC directory.

Now the problem I'm having. I want to redirect requests for abc.xyz.com to abc.com ... I also want to redirect requests for xyz.com/ABC to abc.com so the additional domain files never get served as if they were part of the xyz.com domain.

Using some examples provided by the hosting provider and other resources I've tried the following but it is not doing what is expected.



RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\.xyz\.com$ [OR]
RewriteCond %{HTTP_HOST} ^xyz\.com$
RewriteCond %{REQUEST_URI} ^/ABC/(.*)$
RewriteRule ^(.*)$ http://abc.com/ [R=301,L]

RewriteCond %{HTTP_HOST} ^abc\.xyz\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.abc\.xyz\.com$
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ http://abc.com/ [R=301,L]


What I expected to happen with those rules is:

A: xyz.com/ABC would end up going to abc.com
B: abc.xyz.com would end up going to abc.com

Needless to say neither of those things are happening and I'm not sure why. It's probably something obvious but darned if I can see it. Any assistance or pointers would be greatly appreciated.

djm0219
08-13-2011, 09:42 PM
RewriteEngine on

RewriteCond %{HTTP_HOST} ^abc.xyz.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.abc.xyz.com$ [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ http://abc.com/ [R=301,L]


What I expected to happen with those rules is:

B: abc.xyz.com would end up going to abc.com

This much of the problem has been resolved. Works a LOT better when you put the rules in the correct directory :( Sighhhhhhh

The first part of the problem is still outstanding however.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum