neskaya
Follow [ bookmark livejournal facebook twitter rss stumbleupon ]
Log in to download layouts, skins, and emoticons. Register?

Designs

Web Templates
LJ Layouts
phpBB3 Skins

Graphics

Avatars
Textures
Buttons
Emoticons
Pixels
Fonts

Misc & Fun

Quizzes
Tutorials
Interactive

Community

Forums
Rotation

Site

FAQ & Contact
Links

Affiliates

Komet Tails
Smile Scan
Dragonrain

PHP Tutorial: Link Redirection (from a single page)

I had a really hard time finding out how to do this when I wanted to learn, so I'll put a tutorial up for anyone else who was wondering. Have you ever wondered how people have links that look like yoursite.com/exit.php?id=1 and it redirects to a different site? It's really useful if you want all of your affiliates to have only one link from your site as the referral URL, for example. This is how you do it.

Put the following code into a text file and save the file as exit.php (or whatever other name you want to use for the links):

Where it has a number (1, 2, 3), that is your ID. So yoursite.com/exit.php?id=1 would redirect to neskaya.net, see? You can change the ID to include multiple numbers or letters if you wish.

Feel free to add more links, but remember - all of the links must be followed by a comma except for the last one.

In the if statement, you see the world 'id' twice. You can change that word if you wish. For example, if you change it to 'link' then you would be redirected to neskaya.net from yoursite.com/exit.php?link=1.

Save and upload exit.php (or your file name) onto your server. That's all there is to it!