Click to See Complete Forum and Search --> : Detecting Browser Address


chestertb
11-10-2003, 06:35 PM
Hi All,

Is there a way for PHP to detect the address that the user has typed in the browser?

We've temporarily parked two domain names under our primary hosting account. When the user goes to parked.com, he will in fact end up at main.com, but parked.com will remain in his browser. We'd like to intercept him at that point, and redirect him to a page we'll set up for parked.com.

Thanks
CTB

DaiWelsh
11-11-2003, 10:45 AM
Depends how the user gets from parked.com to main.com, if parked.com has a DNS entry pointing at your server IP then you should just be able to get $_SERVER["SERVER_NAME"]

If the DNS points at main.com by host name then it may be $_SERVER["SERVER_NAME"] or may be $_SERVER["HTTP_REFERER"] or may be neither not quite sure.

Anyway if it is possible the answer will almost certainly lie in the $_SERVER array so you could always dump it and look for the right value :)

chestertb
11-11-2003, 06:09 PM
Outstanding. Thanks.
CTB