论坛转换网's Archiver

白乐天 发表于 2010-12-27 20:36

Discuz!NT=>Discuz! X1.5保持搜索引擎带来的流量之rewrite 规则

将下列内容保存为httpd.ini,或者直接下载附件包即可。此规则IIS适用,apache用户可据此自行修改。[code][ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
RewriteRule ^(.*)/archiver/showforum-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=forumdisplay&fid=$2&archiver=1
RewriteRule ^(.*)/archiver/showtopic-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=viewthread&tid=$2&archiver=1
RewriteRule ^(.*)/showtree.aspx\?topicid=([0-9]+)&postid=([0-9]+)\?*(.*)$ $1/thread-$2-1-1\.html [R]
RewriteRule ^(.*)/showtree.aspx\?postid=([0-9]+)\?*(.*)$ $1/thread-$2-1-1\.html [R]
RewriteRule ^(.*)/showforum-([0-9]+)\.html\?*(.*)$ $1/forum-$2-1\.html [R]
RewriteRule ^(.*)/showforum-([0-9]+)(?:-([0-9]+))?\.html\?*(.*)$ $1/forum-$2-$3\.html [R]
RewriteRule ^(.*)/showforum-([0-9]+)\.aspx\?*(.*)$ $1/forum-$2-1\.html [R]
RewriteRule ^(.*)/showforum-([0-9]+)(?:-([0-9]+))?\.aspx\?*(.*)$ $1/forum-$2-$3\.html [R]
RewriteRule ^(.*)/showtopic.aspx\?topicid=([0-9]+)\?*(.*)$ $1/thread-$2-1-1\.html [R]
RewriteRule ^(.*)/showtopic-([0-9]+)\.html\?*(.*)$ $1/thread-$2-1-1\.html [R]
RewriteRule ^(.*)/showtopic-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/thread-$2-$3-1\.html [R]
RewriteRule ^(.*)/showtopic-([0-9]+)(?:-([0-9]+)(?:-([0-9]+))?)?\.html\?*(.*)$ $1/thread-$2-$3-$4\.html [R]
RewriteRule ^(.*)/showtopic-([0-9]+)\.aspx\?*(.*)$ $1/thread-$2-1-1\.html [R]
RewriteRule ^(.*)/showtopic-([0-9]+)-([0-9]+)\.aspx\?*(.*)$ $1/thread-$2-$3-1\.html [R]
RewriteRule ^(.*)/showtopic-([0-9]+)(?:-([0-9]+)(?:-([0-9]+))?)?\.aspx\?*(.*)$ $1/thread-$2-$3-$4\.html [R]
RewriteRule ^(.*)/topic-(.+)\.html\?*(.*)$ $1/portal\.php\?mod=topic&topic=$2&$3
RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/portal\.php\?mod=view&aid=$2&page=$3&$4
RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3&$4
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$5
RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=group&fid=$2&page=$3&$4
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html\?*(.*)$ $1/home\.php\?mod=space&$2=$3&$4
RewriteRule ^(.*)/([a-z]+)-(.+)\.html\?*(.*)$ $1/$2\.php\?rewrite=$3&$4[/code]

huatinghu 发表于 2010-12-27 21:14

非常实用,谢谢老大!

huatinghu 发表于 2010-12-28 13:37

貌似要放在根目录才能加载。
[attach]141[/attach]
[attach]142[/attach]

夠了ч! 发表于 2011-12-17 15:11

老大
这个规则适用于dx2吗?
现在都说dx1.5的规则好像对dx2.0有bug啊
怎么办

白乐天 发表于 2011-12-18 09:31

这个是我单独写的 ,没发现有问题。你说的问题是什么,具体一点。

夠了ч! 发表于 2012-2-12 23:21

白老师,我的虚拟机配置突然变成ii7.5了
那该怎么重定向呢?
我写了一个[code]
<rule name="set10">
</rule>
[/code]能成功连接到主题,但是状态是200,URL都不会变,不会自动换成现在的主题连接。

白乐天 发表于 2012-2-15 10:25

我手边没有IIS7,没办法测试。只凭看,单只这一段的话,我觉得你写的没错。rewrite规则之间的顺序也是有影响的,你把整个规则贴出来。



页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2009 Comsenz Inc.