天空小小岛技术网站

标题: 升级到Discuz!X后,原来版块或帖子访问地址仍可正常访问的Rewrite规则 [打印本页]

作者: 云天一    时间: 2010-5-13 16:44
标题: 升级到Discuz!X后,原来版块或帖子访问地址仍可正常访问的Rewrite规则
升级到Discuz!X后,版块或帖子保持原来访问地址的Rewrite规则

iis6下规则

  1. [ISAPI_Rewrite]

  2. # 3600 = 1 hour
  3. CacheClockRate 3600

  4. RepeatLimit 32
  5. RewriteRule ^(.*)/(forumdisplay|viewthread|redirect|faq)\.php\?(.*) $1/forum\.php\?mod=$2&$3
  6. RewriteRule ^(.*)/(space)\.php\?(.*) $1/home\.php\?mod=$2&$3
复制代码
iis7下规则加在web.config里面

  1. <rule name="for_bbs">
  2.         <match url="^(.*)/(forumdisplay|viewthread|redirect|faq).php" />
  3.         <action type="Rewrite" url="{R:1}/forum.php?mod={R:2}&amp;%{QUERY_STRING}" />
  4. </rule>
  5. <rule name="for_uchome">
  6.         <match url="^(.*)/(space).php" />
  7.         <action type="Rewrite" url="{R:1}/home.php?mod={R:2}&amp;%{QUERY_STRING}" />
  8. </rule>
复制代码
apache虚拟机用户在官方给出的规则后面加

  1. RewriteEngine On
  2. # 修改以下语句中的 /x 为你的论坛目录地址,如果程序放在根目录中,请将 /x 修改为 /
  3. RewriteBase /x

  4. RewriteCond %{QUERY_STRING} ^(.*)$
  5. RewriteRule ^(forumdisplay|viewthread|redirect|faq)\.php forum.php?mod=$1&%1
  6. RewriteCond %{QUERY_STRING} ^(.*)$
  7. RewriteRule ^(space)\.php home.php?mod=$1&%1
复制代码
apache独立主机

  1. <IfModule mod_rewrite.c>
  2. RewriteRule ^(.*)/(forumdisplay|viewthread|redirect|faq)\.php $1/forum.php?mod=$2&%{QUERY_STRING}
  3. RewriteRule ^(.*)/(space)\.php $1/home.php?mod=$2&%{QUERY_STRING}
  4. </IfModule>
复制代码

作者: 八号    时间: 2010-6-13 09:47
保持UCHOME相关链接 方法:http://www.tkxxd.net/thread-183-1-1.html
作者: 一粒米    时间: 2014-8-26 17:50
nginx 的怎么能没有呢?
  1. rewrite ^(.*)/(forumdisplay|viewthread|redirect|faq)\.php $1/forum.php?mod=$2&$query_string last;
  2. rewrite ^(.*)/(space)\.php $1/home.php?mod=$2&$query_string last;
复制代码





欢迎光临 天空小小岛技术网站 (http://tkxxd.net/) Powered by Discuz! X3.1