论坛 修改.htaccess 加入如下代码:

  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

升级到 Discuz!X 后 保持 UCHOME 原链接可正常访问 rewrite

  1. RewriteRule ^(.*)/space-(d+)-do-(.+)-(.+)-([0-9]+).html?*(.*)$ $1/home.php?mod=space&uid=$2&do=$3&$4=$5
  2. RewriteRule ^(.*)/space-mtag.html?*(.*)$ $1/group.php
  3. RewriteRule ^(.*)/space-event.html?*(.*)$ $1/home.php?mod=space&do=activity
  4. RewriteRule ^(.*)/space-(.*).html?*(.*)$ $1/home.php?mod=space&do=$2

论坛 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;

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. <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>
对于源程序在 bbs 文件夹, 升级后在根目录了, 保持原链接不失效的方法

  1. RewriteEngine On
  2. # 修改以下语句中的 /x 为你的论坛目录地址,如果程序放在根目录中,请将 /x 修改为 /
  3. RewriteBase /
  4. RewriteRule ^bbs(.*)$ http://www.violinstudy.net$1 [R]
  5. RewriteCond %{QUERY_STRING} ^(.*)$
  6. RewriteRule ^(forumdisplay|viewthread|redirect|faq).php forum.php?mod=$1&%1
  7. RewriteCond %{QUERY_STRING} ^(.*)$
  8. RewriteRule ^(space).php home.php?mod=$1&%1
  9. RewriteCond %{QUERY_STRING} ^(.*)$
  10. RewriteRule ^topic-(.+).html$ portal.php?mod=topic&topic=$1&%1
  11. RewriteCond %{QUERY_STRING} ^(.*)$
  12. RewriteRule ^article-([0-9]+)-([0-9]+).html$ portal.php?mod=view&aid=$1&page=$2&%1
  13. RewriteCond %{QUERY_STRING} ^(.*)$
  14. RewriteRule ^forum-(w+)-([0-9]+).html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
  15. RewriteCond %{QUERY_STRING} ^(.*)$
  16. RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+).html$ forum.php?mod=viewthread&tid=$1&extra=page%3D$3&page=$2&%1
  17. RewriteCond %{QUERY_STRING} ^(.*)$
  18. RewriteRule ^group-([0-9]+)-([0-9]+).html$ forum.php?mod=group&fid=$1&page=$2&%1
  19. RewriteCond %{QUERY_STRING} ^(.*)$
  20. RewriteRule ^space-(username|uid)-(.+).html$ home.php?mod=space&$1=$2&%1
  21. RewriteCond %{QUERY_STRING} ^(.*)$
  22. RewriteRule ^([a-z]+)-(.+).html$ $1.php?rewrite=$2&%1