View Single Post
Old 2005-08-01, 07:58 AM   #19
CelticTiger
Are you sure this is the Sci-Fi Convention? It's full of nerds!
 
CelticTiger's Avatar
 
Join Date: Feb 2004
Location: Ireland
Posts: 266
Send a message via ICQ to CelticTiger
It's not really necessary to go as far as using mod_rewrite in your .htaccess

Here's the code I like to use:
PHP Code:
<?php
switch($_GET['id'])
{
case(
'1'):
$location 'sponsor url here';
break;
case(
'2'):
$location 'sponsor url here';
break;
case(
'3'):
$location 'sponsor url here';
break;
default:
echo 
'Error: No ID Specified';
exit;
break;
}
header('Location: ' $location);
?>
Save as links.php or whatever you wish. Using categories like amateur-links.php for your amateur links etc is also helpful in keeping things organized. You can add more links as required by simply adding in :

PHP Code:
case('4'):
$location 'sponsor url here';
break; 
before the code
PHP Code:
default:
echo 
'Error: No ID Specified';
exit;
break; 
Just make sure you change the case numbers.


Upload the file to your server and
now you simply use: "links.php?id=1" ie

http://www.domain.com/links.php?id=1 where the id=1 represents
PHP Code:
case('1'):
$location 'sponsor url here'
Now for example if the sponsor/site in
PHP Code:
case('1'):
$location 'sponsor url here'
is performing badly or the sponsor goes under you can simply change the url to something else and your traffic is rerouted to another site.

Hope this helps.
CelticTiger is offline   Reply With Quote