本帖最后由 beijing200808 于 2009-11-27 17:28 编辑
PHPWind 转换到 Discuz!7.1 后,论坛内容的访问地址会发生变化,这就导致论坛用户原来保存的信息访问地址无效,给站长造成一定程序的损失。为避免这种情况的发生,我们整理了一下 PHPWind 转换到 Discuz!7.1 后的 rewrite 规则:
一、Apache 下- RewriteRule ^(.*)/read-htm-tid-([0-9]+)\.html$ $1/viewthread\.php\?tid=$2 [R=301,L]
- RewriteRule ^(.*)/read\.php\?tid-([0-9]+)\.html$ $1/viewthread\.php\?tid=$2 [R=301,L]
- RewriteRule ^(.*)/thread-htm-fid-([0-9]+)\.html$ $1/forumdisplay\.php\?fid=$2 [R=301,L]
- RewriteRule ^(.*)/thread-htm-fid-([0-9]+)-type-([0-9]+)\.html$ $1/forumdisplay\.php\?fid=$2&filter=type&typeid=$3 [R=301,L]
- RewriteRule ^(.*)/thread-htm-fid-([0-9]+)-search-digest\.html$ $1/forumdisplay\.php\?fid=$2&filter=digest [R=301,L]
- RewriteRule ^(.*)/profile-htm-action-show-(username|uid)-(.*)\.html$ $1/space\.php\?action=viewpro&$2=$3 [R=301,L]
- RewriteRule ^(.*)/thread-htm-fid-([0-9]+)([a-z\-]+)([0-9]+)\.html$ $1/forumdisplay\.php\?fid=$2&page=$4 [R=301,L]
- RewriteRule ^(.*)/read-htm-tid-([0-9]+)-page-([0-9]+)-fpage-([0-9]+)\.html$ $1/viewthread\.php\?tid=$2&extra=page%3D1&page=$3 [R=301,L]
- RewriteRule ^(.*)/index-htm-m-area\.html$ $1/index.php [R=301,L]
- RewriteRule ^(.*)/index-htm-m-bbs\.html$ $1/index.php [R=301,L]
- RewriteRule ^(.*)/index-htm-m-o\.html$ $1/space.php?do=home [R=301,L]
- RewriteCond %{QUERY_STRING} ^tid-([0-9]+)\.html$
- RewriteRule ^(.*)/read.php$ $1/viewthread.php?tid=%1 [R=301,L]
- RewriteCond %{QUERY_STRING} ^tid-([0-9]+)$
- RewriteRule ^(.*)/read.php$ $1/viewthread.php?tid=%1 [R=301,L]
- RewriteCond %{QUERY_STRING} ^fid=([0-9]+)$
- RewriteRule ^(.*)/thread.php$ $1/forumdisplay.php?fid=%1 [R=301,L]
- RewriteCond %{QUERY_STRING} ^fid=([0-9]+)&type=([0-9]+)$
- RewriteRule ^(.*)/thread.php$ $1/forumdisplay.php?fid=%1&filter=type&typeid=%2 [R=301,L]
- RewriteCond %{QUERY_STRING} ^fid=([0-9]+)&search=digest$
- RewriteRule ^(.*)/thread.php$ $1/forumdisplay.php?fid=%1&filter=digest [R=301,L]
- RewriteCond %{QUERY_STRING} ^action=show&(username|uid)=(.*)$
- RewriteRule ^(.*)/profile.php$ $1/space.php?action=viewpro&%1=%2 [R=301,L]
- RewriteCond %{QUERY_STRING} ^fid=([0-9]+)([a-zA-Z=&]+)([0-9]+)$
- RewriteRule ^(.*)/thread.php$ $1/forumdisplay.php?fid=%1&page=%3 [R=301,L]
- RewriteCond %{QUERY_STRING} ^tid=([0-9]+)&page=([0-9]+)&fpage=([0-9]+)$
- RewriteRule ^(.*)/read.php$ $1/viewthread.php?tid=%1&extra=page\%3D1&page=%2 [R=301,L]
- RewriteCond %{QUERY_STRING} ^m=o&q=browse$
- RewriteRule ^(.*)/mode.php$ $1/network.php [R=301,L]
- RewriteCond %{QUERY_STRING} ^m=o&q=user&u=([0-9]+)$
- RewriteRule ^(.*)/mode.php$ $1/space.php?uid=%1 [R=301,L]
- RewriteCond %{QUERY_STRING} ^m=o&space=([0-9]+)&u=([0-9]+)&q=write$
- RewriteRule ^(.*)/mode.php$ $1/space.php?uid=%2 [R=301,L]
- RewriteCond %{QUERY_STRING} ^m=o&space=([0-9]+)&u=([0-9]+)&q=diary$
- RewriteRule ^(.*)/mode.php$ $1/space.php?uid=%2 [R=301,L]
- RewriteCond %{QUERY_STRING} ^m=o&q=diary&space=([0-9]+)&u=([0-9]+)&did=([0-9]+)$
- RewriteRule ^(.*)/mode.php$ $1/space.php?uid=%2&do=blog&id=%3 [R=301,L]
- RewriteCond %{QUERY_STRING} ^m=o&space=([0-9]+)&u=([0-9]+)&q=photos$
- RewriteRule ^(.*)/mode.php$ $1/space.php?uid=%2 [R=301,L]
- RewriteCond %{QUERY_STRING} ^m=o&q=photos&space=([0-9]+)&u=([0-9]+)&a=album&aid=([0-9]+)$
- RewriteRule ^(.*)/mode.php$ $1/space.php?uid=%2&do=album&id=%3 [R=301,L]
- RewriteCond %{QUERY_STRING} ^m=o&q=photos&space=([0-9]+)&u=([0-9]+)&a=view&pid=([0-9]+)$
- RewriteRule ^(.*)/mode.php$ $1/space.php?uid=%2&do=album&picid=%3 [R=301,L]
- RewriteCond %{QUERY_STRING} ^m=o&q=share&space=([0-9]+)&u=([0-9]+)&a=$
- RewriteRule ^(.*)/mode.php$ $1/space.php?uid=%2 [R=301,L]
- RewriteCond %{QUERY_STRING} ^m=o&space=([0-9]+)&u=([0-9]+)&q=groups$
- RewriteRule ^(.*)/mode.php$ $1/space.php?do=mtag [R=301,L]
复制代码 其中,“-htm-”(不含引号)为 PHPWind 后台设置的静态目录,“.html” 为 PHPWind 后台设置的静态目录扩展名;
第37行至第56行,主要是针对 PHPWind 的圈子而设置的 rewrite 规则。当 PHPWind 转换到 Discuz!7.1 后,相应的其圈子信息转换到 UCenter Home,这部分的域名可能发生改变,此时的 rewrite 规则,只需要将“$1” 修改成对应的域名就可以了。例如:- RewriteCond %{QUERY_STRING} ^m=o&q=user&u=([0-9]+)$
- RewriteRule ^(.*)/mode.php$ http://www.52here.cn/space.php?uid=%1 [R=301,L]
复制代码 二、IIS下- RewriteRule ^(.*)/read-htm-tid-([0-9]+)\.html$ $1/viewthread\.php\?tid=$2
- RewriteRule ^(.*)/read\.php\?tid-([0-9]+)\.html$ $1/viewthread\.php\?tid=$2
- RewriteRule ^(.*)/thread-htm-fid-([0-9]+)\.html$ $1/forumdisplay\.php\?fid=$2
- RewriteRule ^(.*)/thread-htm-fid-([0-9]+)-type-([0-9]+)\.html$ $1/forumdisplay\.php\?fid=$2&filter=type&typeid=$3
- RewriteRule ^(.*)/thread-htm-fid-([0-9]+)-search-digest\.html$ $1/forumdisplay\.php\?fid=$2&filter=digest
- RewriteRule ^(.*)/profile-htm-action-show-(username|uid)-(.*)\.html$ $1/space\.php\?action=viewpro&$2=$3
- RewriteRule ^(.*)/thread-htm-fid-([0-9]+)([a-z\-]+)([0-9]+)\.html$ $1/forumdisplay\.php\?fid=$2&page=$4
- RewriteRule ^(.*)/read-htm-tid-([0-9]+)-page-([0-9]+)-fpage-([0-9]+)\.html$ $1/viewthread\.php\?tid=$2&extra=page%3D1&page=$3
- RewriteRule ^(.*)/read\.php\?tid=([0-9]+)$ $1/viewthread\.php\?tid=$2
- RewriteRule ^(.*)/thread\.php\?fid=([0-9]+)$ $1/forumdisplay\.php\?fid=$2
- RewriteRule ^(.*)/thread\.php\?fid=([0-9]+)&type=([0-9]+)$ $1/forumdisplay\.php\?fid=$2&filter=type&typeid=$3
- RewriteRule ^(.*)/thread\.php\?fid=([0-9]+)&search=digest$ $1/forumdisplay\.php\?fid=$2&filter=digest
- RewriteRule ^(.*)/simple/index\.php\?(t|f)([0-9]+\.html)$ $1/archiver/?$2id-$3
- RewriteRule ^(.*)/profile\.php\?action=show&(username|uid)=(.*)$ $1/space\.php\?action=viewpro&$2=$3
- RewriteRule ^(.*)/thread\.php\?fid=([0-9]+)([a-zA-Z=&]+)([0-9]+)$ $1/forumdisplay\.php\?fid=$2&page=$4
- RewriteRule ^(.*)/read\.php\?tid=([0-9]+)&page=([0-9]+)&fpage=([0-9]+)$ $1/viewthread\.php\?tid=$2&extra=page%3D1&page=$3
- RewriteRule ^(.*)/index-htm-m-area\.html$ $1/index\.php
- RewriteRule ^(.*)/index-htm-m-bbs\.html$ $1/index\.php
- RewriteRule ^(.*)/index-htm-m-o\.html$ $1/space\.php\?do=home
- RewriteRule ^(.*)/mode\.php\?m=o&q=browse$ $1/network\.php
- RewriteRule ^(.*)/mode\.php\?m=o&q=user&u=([0-9]+)$ $1/space\.php\?uid=$2
- RewriteRule ^(.*)/mode\.php\?m=o&space=([0-9]+)&u=([0-9]+)&q=([a-z]+)$ $1/space\.php\?uid=$3
- RewriteRule ^(.*)/mode\.php\?m=o&q=share&space=([0-9]+)&u=([0-9]+)&a=$ $1/space\.php\?uid=$3
- RewriteRule ^(.*)/mode\.php\?m=o&q=diary&space=([0-9]+)&u=([0-9]+)&did=([0-9]+)$ $1/space\.php\?uid=$3&do=blog&id=$4
- RewriteRule ^(.*)/mode\.php\?m=o&q=photos&space=([0-9]+)&u=([0-9]+)&a=album&aid=([0-9]+)$ $1/space\.php\?uid=$3&do=album&id=$4
- RewriteRule ^(.*)/mode\.php\?m=o&q=photos&space=([0-9]+)&u=([0-9]+)&a=view&pid=([0-9]+)$ $1/space\.php\?uid=$3&do=album&picid=$4
- RewriteRule ^(.*)/mode\.php\?m=o&space=([0-9]+)&u=([0-9]+)&q=groups$ $1/space\.php\?do=mtag
复制代码 其中,“-htm-”(不含引号)为 PHPWind 后台设置的静态目录,“.html” 为 PHPWind 后台设置的静态目录扩展名;
第17行至第27行,主要是针对 PHPWind 的圈子而设置的 rewrite 规则。当 PHPWind 转换到 Discuz!7.1 后,相应的其圈子信息转换到 UCenter Home,这部分的域名可能发生改变,此时的 rewrite 规则,只需要将“$1” 修改成对应的域名就可以了。
附件中是 IIS 下的 rewrite 附件,下载后按照里面的 readme.txt 进行操作即可。
注:压缩包中的 rewrite 规则仅是转换过程的rewrite规则,不包含 Discuz! 论坛自身的 rewrite 规则,使用时,自行添加到 httpd.ini文件中即可。
如果大家在使用中有什么问题,可以在下面跟帖提问 |