Redirection according to URL?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Nimue
Forum Newbie
Posts: 2
Joined: Fri Aug 01, 2003 3:08 pm
Location: Redmond, WA

Redirection according to URL?

Post 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.
mrskumm
Forum Newbie
Posts: 10
Joined: Tue Jul 22, 2003 5:40 am
Location: Sweden

Post 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?
Nimue
Forum Newbie
Posts: 2
Joined: Fri Aug 01, 2003 3:08 pm
Location: Redmond, WA

Post by Nimue »

mrskumm wrote:try looking on php.net on the header() command...
Looks like that will do it. Thanks.
Post Reply