插件作者的标准出来了!Manyou诚邀开发者加盟!
“互联网平台开发者”特刊 有奖征集开发者
立即免费下载 Discuz!6.1.0正式版
Discuz! 6.1.0 使用说明
Discuz!NT2.5正式版发布
开放源码下载
UCenter Home 1.2 正式版发布
官方站 | 帮助文档
基于ECShop的网店托管-卖否
PHP就业培训直通车 | LAMP培训大连
Discuz!收费服务内容及价格
“感谢有你同行”手握手2008年数万元重奖志愿者
Discuz!/ECShop 专用官方虚拟主机
【九城-奇迹世界】专题活动开始了!
Comsenz 招聘信息
网店系统ECShop v2.6.0正式版火热发布
基于Discuz!的免费论坛空间5D6D
参与有奖社区调查 赢取台湾5日游
发新话题
打印

[经验] PW论坛转换成DZ论坛后的原静态URL失效问题完美解决方案

PW论坛转换成DZ论坛后的原静态URL失效问题完美解决方案

很多的朋友的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 编辑 ]
本帖最近评分记录
  • 紫琼 威望 +3 谢谢分享经验,支持一个! 2006-12-20 10:48
  • 紫琼 +3 谢谢分享经验,支持一个! 2006-12-20 10:48
昨天、前天还在求助呢,求人不如求已啊,还长了大量的知识

建议加精
修改了一下,希望对大家有用

附上ZEUS的

match URL into $ with ^(.*)/read-html-tid-(.*)$
if matched then
set URL = $1/viewthread.php?tid=$2
endif
match URL into $ with ^(.*)/thread-html-fid-(.*)$
if matched then
set URL = $1/forumdisplay.php?fid=$2
endif
match URL into $ with ^(.*)/simple/f(.*)$
if matched then
set URL = $1/archiver/index.php?fid-$2
endif
match URL into $ with ^(.*)/simple/t(.*)$
if matched then
set URL = $1/archiver/index.php?tid-$2
endif
match URL into $ with ^(.*)/simple/index.php\?f(.*)$
if matched then
set URL = $1/archiver/index.php?fid-$2
endif
match URL into $ with ^(.*)/simple/index.php\?t(.*)$
if matched then
set URL = $1/archiver/index.php?tid-$2
endif
match URL into $ with ^(.*)/archiver/([a-z0-9\-]+\.html)$
if matched then
set URL = $1/archiver/index.php?$2
endif
match URL into $ with ^(.*)/forum-([0-9]+)-([0-9]+)\.html$
if matched then
set URL = $1/forumdisplay.php?fid=$2&page=$3
endif
match URL into $ with ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$
if matched then
set URL = $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3
endif
match URL into $ with ^(.*)/profile-(username|uid)-(.+?)\.html$
if matched then
set URL = $1/viewpro.php?$2=$3
endif

[ 本帖最后由 zw80 于 2006-12-20 13:47 编辑 ]
谢谢分享,不错,支持
加了几条,呵呵,这下就更少有失效的了
帮顶。不错的代码。
论坛复制大转移出世
1.采集规则2.火车头登陆模块3.数据转换4.全站+论坛数据采集
数据1.两性网2.英文网3.宠物全站>>>以上联系QQ:83202700
。。。。
- -!
支持一下
呵呵
欢迎访问清风论坛
http://00ip.cn
(::35:
发新话题
版块跳转