<?php
// MySQL bağlantı kodlarınız..
$r = mysql_query(sprintf('SELECT `adres` FROM tablo_adiniz WHERE `name` = %s AND `cid` = %d', mysql_real_escape_string($_GET['name']), mysql_real_escape_string($_GET['cid'])));
if ($r) {
$row = mysql_fetch_assoc($r);
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $row['adres']);
} else
header('Location: /');
die();