很多的朋友的PW论坛伪静态化之后,论坛地址全部变成:
read-htm-??.html
thread-htm-???.html
转换到DZ论坛后势必会流失大量的搜索引擎过来的URL,如何让它继续有效呢?
经过两天的测试和摸索,终于把这个问题解决掉了
1、在http.conf有关虚拟主机的 <IfModule mod_rewrite.c></IfModule>之间加上以下代码
复制内容到剪贴板
代码:
RewriteRule ^(.*)/archiver/([a-z0-9\-]+\.html)$ $1/archiver/index.php?$2
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3
RewriteRule ^(.*)/profile-(username|uid)-(.+)\.html$ $1/viewpro.php?$2=$3
RewriteRule ^/thread-htm-fid-([0-9]+)(.*)\.html$ /forumdisplay.php?fid=$1 [L,R]
RewriteRule ^/thread.php(.*)$ /forumdisplay.php$1 [L,R]
RewriteRule ^/read-htm-tid-([0-9]+)(.*)\.html$ /viewthread.php?tid=$1 [L,R]
RewriteRule ^/read.php(.*)$ /viewthread.php$1 [L,R]
RewriteRule ^/home.php$ /index.php [L,R]
RewriteRule ^/simple/ /archiver/ [R]
RewriteRule ^/notice.php /announcement.php [R]
RewriteRule ^/notice-htm-(.*)\.html /announcement.php [R]
RewriteRule ^/job-htm-(.*)\.html /index.php [R]
RewriteRule ^/job.php /index.php [R]
RewriteRule ^/bt.php /forumdisplay.php?fid=99 [R]
RewriteRule ^/bt-htm-(.*)\.html /forumdisplay.php?fid=99 [R]2、在archiver/index.php
里找到
复制内容到剪贴板
代码:
if($tid) {
$action = 'thread';
$forward = 'viewthread.php?tid='.$tid;
} elseif($fid) {
$action = 'forum';
$forward = 'forumdisplay.php?fid='.$fid;
} else {
$action = 'index';
$forward = 'index.php';
}在它之前加上
复制内容到剪贴板
代码:
$R_URL=substr(($cutchar=strrchr($REQUEST_URI,'?')) ? substr($cutchar,1) :'',0,-5);
if($R_URL){
$R_URL_A=explode('_',$R_URL);
$prog=substr($R_URL_A[0],0,1);
$id=(int)substr($R_URL_A[0],1);
$page=(int)$R_URL_A[1];
}else{
$prog='';
}
switch($prog){
case 'f':
$fid =& $id;break;
// include_once(R_P.'simple/mod_thread.php');
case 't':
$tid =& $id;break;
// include_once(R_P.'simple/mod_read.php');
default:
// include_once(R_P.'simple/mod_index.php');
}不过这时一定要启用Achiver静态化,不然Achiver就没用了
基本上就可以了,
[
本帖最后由 stanley 于 2006-12-21 10:26 编辑 ]