Why don't I have a loop error with these redirects?

Posted by byronyasgur on Pro Webmasters See other posts from Pro Webmasters or by byronyasgur
Published on 2011-06-24T14:41:39Z Indexed on 2011/06/25 16:30 UTC
Read the original article Hit count: 308

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?

© Pro Webmasters or respective owner

Related posts about web-development

Related posts about htaccess