Forum Moderators: phranque

Message Too Old, No Replies

redirect based on domain name.

redirect based on domain name.

         

chetanmadaan

7:03 am on Jan 23, 2011 (gmt 0)

10+ Year Member



Hi -

we have two domain names pointing to the same directory...

somebusinesscompany.com
sbc.com

but basically somebusinescompany.com is the domain name we have setup for users and sbc.com is setup for our self and make edits.

further we have PHP file which detects what url is the user coming from and redirect according to the PHP database file.

all i need is a .htaccess file to detect users if they are coming from sbc.com and ask them for apache authentication.

any tips?

Also, we don't want any authentication for somebusinesscompany.com
it's just if the users is opening sbc.com

jdMorgan

11:50 pm on Jan 24, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Basic Authentication/authorization is done on a per-directory basis. So you can "protect" directories, but not by domain.

As a result, this is not very useful if both domains point to the same documentroot path...

If you still wish both domains to access the same filepaths, consider simply redirecting all sbc.com requests to the corresponding URL-paths on somebusinesscompany.com if the request comes from outside your own local area network. A rewriterule with rewriteconds examining the %{HTTP_HOST} and %{REMOTE_ADDR} variables could be used to implement this easily.

Jim

chetanmadaan

12:04 am on Jan 25, 2011 (gmt 0)

10+ Year Member



Thanks but no Thanks JIM.