Forum Moderators: coopster

Message Too Old, No Replies

http://www.webmasterworld.com/redir.cgi?

         

Eric_Lander

2:39 am on Apr 29, 2003 (gmt 0)

10+ Year Member



When you're using WebmasterWorld, and you're ready to access a link outside of the domain, you pull up this...

_http://www.webmasterworld.com/redir.cgi?f=3&d=12127&url=_http://domain.com_

I'm looking to find a simple script that performs the action of redir.cgi. I can't even see the need for it to log the number of times external URLs are being called upon.

Any ideas? I've looked on HotScripts, PHPBuilder, etc... To no avail. I'm a newbie to any sort of scripting work.

dmorison

6:38 am on Apr 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Eric,

A simple redir.php would use the header() function to send a "Location" header to the browser, which will trundle off to the new location.

usage:

redir.php?url=http://www.example.com/

<?php

// do whatever logging you want to do with $url (update counter in database for example)

header("Location: " . $url);

exit();

?>

That's it!

Eric_Lander

12:27 pm on Apr 29, 2003 (gmt 0)

10+ Year Member



That's awesome. Thanks! I'll try to implement it a bit later in the day.

Eric_Lander

4:29 pm on Apr 29, 2003 (gmt 0)

10+ Year Member



Worked exactly like I needed. Thanks so much.

dmorison

7:01 pm on Apr 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're welcome :)