我不知道你收录的那些链接都有哪些,比如某个帖子收录的链接为 read.php?tid=xxx,你将下面的内容保存为 read.php ,然后放在 dz 的根目录下即可,
[PHP] 纯文本查看 复制代码 <?php
$domain = "http://你的网址";
$request_url = $_SERVER['QUERY_STRING'];
if (empty($request_url)) {
header("Location:$domain");
}
$tid_first_page = '/tid=([0-9]+)/i';
if (preg_match($tid_first_page, $request_url, $matches)) {
$tid_one = "forum\.php\?mod=viewthread&tid=$matches[1]"
header("HTTP/1.1 301 Moved Permanently");
header("Location:$tid_one");
}
else {
header("Location:http://你的网址");
}
?>
|