如果想一个文件管理你的Affiliate连接,可以新建一个PHP文件集中管理,下面以文件砰Aff下的,文件名aff_links.php为例,格式如下:

<?php
# get the title and define the links array
$title = $_GET['title'];
$links = array();
# affiliate links
$links['my-aff-1'] = "http://your-aff-link-1/";
$links['my-aff-2'] = "http://your-aff-link-2/";
$links['my-aff-3'] = "http://your-aff-link-3/";
$links['my-aff-4'] = "http://your-aff-link-4/";

# redirection
#header(‘Location: ‘.$links[$title]); //重定向
#echo "<script>window.location =".$links[$title].";</script>"; //javastript方法
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=0;URL=\"".$links[$title]."\"/>"; //刷新重定向
?>

如何使用:连接中传递参数title="name"即可,如:aff-links.php?title=my-aff-1

具体用法

http://www.zctou.com/Aff/aff-links.php?title=my-aff-1

就是这种形式传递到aff-links.php,aff-links.php通过 $_GET['title']获取以“title”为key的值,再echo(输出)连接,PHP重定向的方法通常有几种,以上均以“#”注释掉

http://www.zctou.com/Aff/aff-links.php?title=my-aff-1带参数,不友好,想再友好一点,变成http://www.zctou.com/Aff/my-aff-1 的形式,可以修改.htaccess

RewriteEngine On
RewriteRule Aff/(.*)$ /Aff/aff-links.php?title=$1 [L]

或者直接装上插件Redirection即可。