News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Default domain accesses (PHP)

Started by mcalan2001, October 30, 2004, 07:45:53 AM

Previous topic - Next topic

mcalan2001

Please can you help:
I'm running an Apache based server, that is getting loads of accesses to the default domain, because DNS's are pointing at the box, but with a domain name that it doesn't host. I'd like to be able to conditionally re-direct these accesses.

I've tried using a PHP program to looks at every Web-Related Variable that I can think of, but I can't detect the domain name that they were trying to access.

Is it available, or is there some way of passing this information to the program?

[Unknown]

echo $_SERVER['HTTP_HOST'];?

Try:

print_r($_SERVER);

-[Unknown]

mcalan2001

I have tried something very similar:

foreach($_SERVER as $key=>$val) {
   echo '$_SERVER['.$key."] = $val<br>\n";
  }

and the name of the requested domain doesn't appear anywhere. Just the default domain.

Oldiesmann

Try echo $_SERVER['SERVER_NAME'];

As for the script, this should work just as well...

foreach($_SERVER as $key=>$val) {
   echo '$_SERVER['. $key .'] = '. $val .'<br />';
  }
Michael Eshom
Christian Metal Fans

Advertisement: