0

I know this may seem a bit of a question in reverse, but I actually don't seem to have a problem I just want to make sure before I proceed.

I have 2 domains domain1.com and domain2.com and a directory my_directory at domain2.com.

I have domain2.com setup as an "add on domain" in the cpanel account of domain1.com so that when I go to domain2.com I am taken to domain1.com/my_directory but the browser shows domain2.com in the addressbar so it looks and acts like and is a separate site.

However when people browse to domain1.com/directory I want the address bar to show domain2.com not domain1.com/directory. So I put a redirect in the htaccess file to redirect domain1.com/directory to domain2.com and it works perfectly, but I think it shouldnt and I'm worried I've done something wrong.

My question is this: domain2.com was already redirected to domain1.com/directory in the first place (I see the redirect in my cpanel under addon domains) so by adding the second redirect in the htaccess file I should be creating a loop!

Could somebody please set my mind at rest and show me why not?

1
  • nice edit jeff you make it seem so easy !! Jun 30, 2011 at 0:06

1 Answer 1

1

You are using 2 different mechanisms.

You have a redirect so that when someone visits domain1.com/my_directory they are redirected to domain2.com.

You have a rewrite so that when someone visits domain2.com they actually see the content from domain1.com/my_directory. This is processed internally within apache. It is not processing the redirect rule.

1
  • thanks - that would make sense but cpanel calls it (under addon domain) a redirect not a rewrite could this be a bit erroneous that would explain it
    – byronyasgur
    Jun 24, 2011 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.