Making PHP direct someone to a diff site

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
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Making PHP direct someone to a diff site

Post by nigma »

I want to make it so that when a user tries to enter a specified part of my site(maybe links or something) they are re-directed to http://www.google.com(or something else). There isn't really a point to doing this, except ofcourse, to further my knoledge(or lack of it) in PHP. Anyone help me with this?

Thanks for all help provided.
User avatar
bznutz
Forum Commoner
Posts: 58
Joined: Mon Dec 09, 2002 9:52 pm
Location: Here
Contact:

Post by bznutz »

Read this:
http://www.php.net/manual/en/function.header.php

Send a raw header to the browser and it'll redirect them transparently.
User avatar
puckeye
Forum Contributor
Posts: 105
Joined: Fri Dec 06, 2002 7:26 pm
Location: Joliette, QC, CA
Contact:

Post by puckeye »

Hi,

2 ways to do that, ASAIK to redirect a visitor to another page.

either use the header("Location: URL"); function http://www.php.net/manual/en/function.header.php NOTE that you have to make sure that there's nothing sent to the user's browser before you use the header() function read more here: viewtopic.php?t=1157

The other way is to use a HTML Meta tag:

Code: Select all

<META HTTP-EQUIV="Refresh" CONTENT="0; URL=THE_URL">
You change the 0 for any amount of seconds you want and THE_URL for the URL you want to point to.
Post Reply