Page 1 of 1

Redirection according to URL?

Posted: Fri Aug 01, 2003 3:08 pm
by Nimue
I have two different domains pointed at my web site and I would like to redirect visitors according to which domain they are trying to access. I've already set up a separate directory within my document directory so that I can keep the files separate.

I feel kind of stupid because I don't even know what to look for. I've tried searching on redirection but have so far come up blank. I'm sure it doesn't need to be any more than a couple of lines of code. I know how to do this with ASP, but not PHP.

Posted: Fri Aug 01, 2003 4:50 pm
by mrskumm
try looking on php.net on the header() command...

header("Location: http://www.somewhere.com/somewhere.php");

NOTE: You MUST NOT output anything (echo, print, or even errors), because it won't work then!

Was that what you wanted?

Posted: Fri Aug 01, 2003 7:09 pm
by Nimue
mrskumm wrote:try looking on php.net on the header() command...
Looks like that will do it. Thanks.