找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 307|回复: 1

Apache Web Server(独立主机用户)

[复制链接]
发表于 2017-12-30 18:24 | 显示全部楼层 |阅读模式
Apache Web Server(独立主机用户)
  1. Apache Web Server(独立主机用户)
  2. <IfModule mod_rewrite.c>
  3.         RewriteEngine On
  4.         RewriteCond %{QUERY_STRING} ^(.*)$
  5.         RewriteRule ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2&%1
  6.         RewriteCond %{QUERY_STRING} ^(.*)$
  7.         RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3&%1
  8.         RewriteCond %{QUERY_STRING} ^(.*)$
  9.         RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&%1
  10.         RewriteCond %{QUERY_STRING} ^(.*)$
  11.         RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&%1
  12.         RewriteCond %{QUERY_STRING} ^(.*)$
  13.         RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3&%1
  14.         RewriteCond %{QUERY_STRING} ^(.*)$
  15.         RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3&%1
  16.         RewriteCond %{QUERY_STRING} ^(.*)$
  17.         RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3&%1
  18.         RewriteCond %{QUERY_STRING} ^(.*)$
  19.         RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html$ $1/archiver/index.php?action=$2&value=$3&%1
  20.         RewriteCond %{QUERY_STRING} ^(.*)$
  21.         RewriteRule ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3&%1
  22. </IfModule>
  23. Apache Web Server(虚拟主机用户)
  24. # 将 RewriteEngine 模式打开
  25. RewriteEngine On

  26. # 修改以下语句中的 /discuz 为您的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 /
  27. RewriteBase /discuz

  28. # Rewrite 系统规则请勿修改
  29. RewriteCond %{QUERY_STRING} ^(.*)$
  30. RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
  31. RewriteCond %{QUERY_STRING} ^(.*)$
  32. RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
  33. RewriteCond %{QUERY_STRING} ^(.*)$
  34. RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
  35. RewriteCond %{QUERY_STRING} ^(.*)$
  36. RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
  37. RewriteCond %{QUERY_STRING} ^(.*)$
  38. RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
  39. RewriteCond %{QUERY_STRING} ^(.*)$
  40. RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
  41. RewriteCond %{QUERY_STRING} ^(.*)$
  42. RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
  43. RewriteCond %{QUERY_STRING} ^(.*)$
  44. RewriteRule ^(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1
  45. RewriteCond %{QUERY_STRING} ^(.*)$
  46. RewriteRule ^([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ plugin.php?id=$1:$2&%1

  47. IIS Web Server(独立主机用户)
  48. [ISAPI_Rewrite]

  49. # 3600 = 1 hour
  50. CacheClockRate 3600

  51. RepeatLimit 32

  52. # Protect httpd.ini and httpd.parse.errors files
  53. # from accessing through HTTP
  54. RewriteRule ^(.*)/topic-(.+)\.html(\?(.*))*$ $1/portal\.php\?mod=topic&topic=$2&$4
  55. RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/portal\.php\?mod=view&aid=$2&page=$3&$5
  56. RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3&$5
  57. RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$6
  58. RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=group&fid=$2&page=$3&$5
  59. RewriteRule ^(.*)/space-(username|uid)-(.+)\.html(\?(.*))*$ $1/home\.php\?mod=space&$2=$3&$5
  60. RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/home\.php\?mod=space&uid=$2&do=blog&id=$3&$5
  61. RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html(\?(.*))*$ $1/archiver/index\.php\?action=$2&value=$3&$5
  62. RewriteRule ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html(\?(.*))*$ $1/plugin\.php\?id=$2:$3&$5

  63. IIS7 Web Server(独立主机用户)
  64. <rewrite>
  65.         <rules>
  66.                 <rule name="portal_topic">
  67.                         <match url="^(.*/)*topic-(.+).html\?*(.*)$" />
  68.                         <action type="Rewrite" url="{R:1}/portal.php\?mod=topic&topic={R:2}&{R:3}" />
  69.                 </rule>
  70.                 <rule name="portal_article">
  71.                         <match url="^(.*/)*article-([0-9]+)-([0-9]+).html\?*(.*)$" />
  72.                         <action type="Rewrite" url="{R:1}/portal.php\?mod=view&aid={R:2}&page={R:3}&{R:4}" />
  73.                 </rule>
  74.                 <rule name="forum_forumdisplay">
  75.                         <match url="^(.*/)*forum-(\w+)-([0-9]+).html\?*(.*)$" />
  76.                         <action type="Rewrite" url="{R:1}/forum.php\?mod=forumdisplay&fid={R:2}&page={R:3}&{R:4}" />
  77.                 </rule>
  78.                 <rule name="forum_viewthread">
  79.                         <match url="^(.*/)*thread-([0-9]+)-([0-9]+)-([0-9]+).html\?*(.*)$" />
  80.                         <action type="Rewrite" url="{R:1}/forum.php\?mod=viewthread&tid={R:2}&extra=page%3D{R:4}&page={R:3}&{R:5}" />
  81.                 </rule>
  82.                 <rule name="group_group">
  83.                         <match url="^(.*/)*group-([0-9]+)-([0-9]+).html\?*(.*)$" />
  84.                         <action type="Rewrite" url="{R:1}/forum.php\?mod=group&fid={R:2}&page={R:3}&{R:4}" />
  85.                 </rule>
  86.                 <rule name="home_space">
  87.                         <match url="^(.*/)*space-(username|uid)-(.+).html\?*(.*)$" />
  88.                         <action type="Rewrite" url="{R:1}/home.php\?mod=space&{R:2}={R:3}&{R:4}" />
  89.                 </rule>
  90.                 <rule name="home_blog">
  91.                         <match url="^(.*/)*blog-([0-9]+)-([0-9]+).html\?*(.*)$" />
  92.                         <action type="Rewrite" url="{R:1}/home.php\?mod=space&uid={R:2}&do=blog&id={R:3}&{R:4}" />
  93.                 </rule>
  94.                 <rule name="forum_archiver">
  95.                         <match url="^(.*/)*(fid|tid)-([0-9]+).html\?*(.*)$" />
  96.                         <action type="Rewrite" url="{R:1}/archiver/index.php\?action={R:2}&value={R:3}&{R:4}" />
  97.                 </rule>
  98.                 <rule name="plugin">
  99.                         <match url="^(.*/)*([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+).html\?*(.*)$" />
  100.                         <action type="Rewrite" url="{R:1}/plugin.php\?id={R:2}:{R:3}&{R:4}" />
  101.                 </rule>
  102.         </rules>
  103. </rewrite>
  104. Zeus Web Server
  105. match URL into $ with ^(.*)/topic-(.+)\.html\?*(.*)$
  106. if matched then
  107.         set URL = $1/portal.php?mod=topic&topic=$2&$3
  108. endif
  109. match URL into $ with ^(.*)/article-([0-9]+)-([0-9]+)\.html\?*(.*)$
  110. if matched then
  111.         set URL = $1/portal.php?mod=view&aid=$2&page=$3&$4
  112. endif
  113. match URL into $ with ^(.*)/forum-(\w+)-([0-9]+)\.html\?*(.*)$
  114. if matched then
  115.         set URL = $1/forum.php?mod=forumdisplay&fid=$2&page=$3&$4
  116. endif
  117. match URL into $ with ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$
  118. if matched then
  119.         set URL = $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$5
  120. endif
  121. match URL into $ with ^(.*)/group-([0-9]+)-([0-9]+)\.html\?*(.*)$
  122. if matched then
  123.         set URL = $1/forum.php?mod=group&fid=$2&page=$3&$4
  124. endif
  125. match URL into $ with ^(.*)/space-(username|uid)-(.+)\.html\?*(.*)$
  126. if matched then
  127.         set URL = $1/home.php?mod=space&$2=$3&$4
  128. endif
  129. match URL into $ with ^(.*)/blog-([0-9]+)-([0-9]+)\.html\?*(.*)$
  130. if matched then
  131.         set URL = $1/home.php?mod=space&uid=$2&do=blog&id=$3&$4
  132. endif
  133. match URL into $ with ^(.*)/(fid|tid)-([0-9]+)\.html\?*(.*)$
  134. if matched then
  135.         set URL = $1/archiver/index.php?action=$2&value=$3&$4
  136. endif
  137. match URL into $ with ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html\?*(.*)$
  138. if matched then
  139.         set URL = $1/plugin.php?id=$2:$3&$4
  140. endif

  141. Nginx Web Server
  142. rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
  143. rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
  144. rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
  145. rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
  146. rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
  147. rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
  148. rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
  149. rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/archiver/index.php?action=$2&value=$3 last;
  150. rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
  151. if (!-e $request_filename) {
  152.         return 404;
  153. }
复制代码


回复

使用道具 举报

 楼主| 发表于 2017-12-30 18:26 | 显示全部楼层
Discuz! X3.4 正式版【2018-01-01】
选用第一个    放置在 .htaccess   根目录下
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|网络文摘收藏 本站内容均来源于网络,仅供大家学习与参考,不代表本站观点。如有侵权,请联系站长删除。

GMT+8, 2025-4-28 17:51 , Processed in 0.021110 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表