论坛转换网's Archiver

白乐天 发表于 2017-1-31 18:38

dvbbs=>Discuz! X保持搜索引擎带来的流量之rewrite 规则(apache版和IIS版)

最近给一个客户写的,分享一下给用得上的人吧。呵呵

IIS版[code][ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32

# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP

RewriteRule ^(.*)/index\.asp\?[bB]oard[iI][dD]=(\d+)$ $1/forum\.php\?mod=forumdisplay&fid=$2
RewriteRule ^(.*)/dispbbs\.asp\?[bB]oard[iI][dD]=(\d+)&[iI][dD]=(\d+)$ $1/forum\.php\?mod=viewthread&tid=$3
RewriteRule ^(.*)/index\.asp\?[bB]oard[iI][dD]=(\d+)&[pP]age=(\d+)$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3
RewriteRule ^(.*)/dispbbs\.asp\?[bB]oard[iI][dD]=(\d+)&[iI][dD]=(\d+)&page=(\d+)$ $1/forum\.php\?mod=viewthread&tid=$3&page=$4
RewriteRule ^(.*)/dispbbs\.asp\?[bB]oard[iI][dD]=(\d+)&[iI][dD]=(\d+)&authorid=(\d+)$ $1/forum\.php\?mod=viewthread&tid=$3&page=1&authorid=$4
RewriteRule ^(.*)/dispbbs\.asp\?[bB]oard[iI][dD]=(\d+)&[iI][dD]=(\d+)&authorid=(\d+)&page=(\d+)&star=(\d+)$ $1/forum\.php\?mod=viewthread&tid=$3&page=$6
RewriteRule ^(.*)/topic-(.+)\.html(\?(.*))*$ $1/portal\.php\?mod=topic&topic=$2&$4
RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/portal\.php\?mod=view&aid=$2&page=$3&$5
RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3&$5
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$6
RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=group&fid=$2&page=$3&$5
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html(\?(.*))*$ $1/home\.php\?mod=space&$2=$3&$5
RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/home\.php\?mod=space&uid=$2&do=blog&id=$3&$5
RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html(\?(.*))*$ $1/index\.php\?action=$2&value=$3&$5
RewriteRule ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html(\?(.*))*$ $1/plugin\.php\?id=$2:$3&$5
[/code]Apache版[code]<IfModule mod_rewrite.c>
# 将 RewriteEngine 模式打开
RewriteEngine On

# Rewrite 系统规则请勿修改

RewriteCond %{QUERY_STRING}  ^[bB]oard[iI][dD]=(\d+)$
RewriteRule ^index\.asp$ forum.php?mod=forumdisplay&fid=%1 [L]
RewriteCond %{QUERY_STRING}  ^[bB]oard[iI][dD]=([0-9]+)&[iI][dD]=([0-9]+)$
RewriteRule ^dispbbs\.asp$ forum.php?mod=viewthread&tid=%2 [L]
RewriteCond %{QUERY_STRING}  ^[bB]oard[iI][dD]=(\d+)&[pP]age=(\d+)$
RewriteRule ^index\.asp$ forum.php?mod=forumdisplay&fid=%1&page=%2 [L]
RewriteCond %{QUERY_STRING}  ^[bB]oard[iI][dD]=(\d+)&TopicMode=(\d+)&List_Type=&[pP]age=(\d+)$
RewriteRule ^index\.asp$ forum.php?mod=forumdisplay&fid=%1&page=%3 [L]
RewriteCond %{QUERY_STRING}  ^[bB]oard[iI][dD]=(\d+)&[iI][dD]=(\d+)&[pP]age=(\d+)$
RewriteRule ^dispbbs\.asp$ forum.php?mod=viewthread&tid=%2&page=%3 [L]
RewriteCond %{QUERY_STRING}  ^[bB]oard[iI][dD]=(\d+)&[iI][dD]=(\d+)&authorid=(\d+)$
RewriteRule ^dispbbs\.asp$ forum.php?mod=viewthread&tid=%2&page=1&authorid=%3 [L]
RewriteCond %{QUERY_STRING}  ^[bB]oard[iI][dD]=(\d+)&[iI][dD]=(\d+)&authorid=(\d+)&[pP]age=(\d+)&star=(\d+)$
RewriteRule ^dispbbs\.asp$ forum.php?mod=viewthread&tid=%2&page=%4&authorid=%3 [L]
RewriteCond %{QUERY_STRING}  ^[bB]oard[iI][dD]=(\d+)&[iI][dD]=(\d+)&[pP]age=(\d+)&move=next$
RewriteRule ^dispbbs\.asp$ forum.php?mod=viewthread&tid=%2&page=%3 [L]
RewriteCond %{QUERY_STRING}  ^[bB]oard[iI][dD]=(\d+)&[iI][dD]=(\d+)&[pP]age=(\d+)&star=(\d+)$
RewriteRule ^dispbbs\.asp$ forum.php?mod=viewthread&tid=%2&page=%3 [L]
RewriteCond %{QUERY_STRING}  ^[bB]oard[iI][dD]=(\d+)&[iI][dD]=(\d+)&star=(\d+)$
RewriteRule ^dispbbs\.asp$ forum.php?mod=viewthread&tid=%2 [L]

RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ plugin.php?id=$1:$2&%1
</IfModule>[/code]

页: [1]

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