QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

切换风格 注册 找回密码

php开发-PHP教程网


发表于 2014-2-2 11:46:48 | 显示全部楼层 |阅读模式
Discuz! X3.1 IIS/Apache/Linux、虚拟主机、VPS、独立主机、服务器伪静态规则的配置

Discuz! X3.1 VPS主机的伪静态httpd.conf规则设置:
(1)服务器系统及 PHP:WINNT / PHP v5.X.X  服务器软件:Microsoft-IIS/6.0
  1. RegistrationName= wlqcwin
  2. RegistrationCode= 2EAD-35GH-66NN-ZYBA

  3. [ISAPI_Rewrite]
  4. # 3600 = 1 hour
  5. CacheClockRate 3600
  6. RepeatLimit 32

  7. # 自定义错误页面

  8. ErrorDocument 404 /404/index.html

  9. # 默认包含了301设置,此设置情况下662p.com/aa.htm 会301跳至www.662p.com/aa.htm,将sxbbs.org替换为您自己的域名就能实现自己的域名的301

  10. # 第一条表示要做跳转的域名,第二条表示要跳转到的域名

  11. RewriteCond %{HTTP:Host} ^662p.com$
  12. RewriteRule (.*) http://www.662p.com$1 [NC,R=301]

  13. # 多个域名做跳转的方法:
  14. # 首先复制多个 RewriteCond 项,将域名改好 除了最后一项,其余的 RewriteCond 项最后都要加个参数 [OR]即可。


  15. RewriteCond %{HTTP:Host} ^662p.com$[OR]
  16. RewriteCond %{HTTP:Host} ^www.662p.com$
  17. RewriteRule (.*) http://www.662p.com$1 [NC,R=301]

  18. # Protect httpd.ini and httpd.parse.errors files
  19. # from accessing through HTTP
  20. # Discuzx3.1
  21. # 主题分类与分类信息伪静态
  22. RewriteCond %{QUERY_STRING} ^(.*)$
  23. RewriteRule ^(.*)/type-(\w+)-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=forumdisplay&fid=$2&typeid=$3&typeid=$3&filter=typeid&page=$4
  24. RewriteCond %{QUERY_STRING} ^(.*)$
  25. RewriteRule ^(.*)/sort-(\w+)-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=forumdisplay&fid=$2&sortid=$3&sortid=$3&filter=sortid&page=$4
  26. #门户专题页伪静态
  27. RewriteCond %{QUERY_STRING} ^(.*)$
  28. RewriteRule ^(.*)/topic-(.+)\.html(\?(.*))*$ $1/portal\.php\?mod=topic&topic=$2&$4
  29. #门户文章页伪静态
  30. RewriteCond %{QUERY_STRING} ^(.*)$
  31. RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/portal\.php\?mod=view&aid=$2&page=$3&$5
  32. #论坛主题列表页伪静态
  33. RewriteCond %{QUERY_STRING} ^(.*)$
  34. RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3&$5
  35. #论坛主题内容页伪静态
  36. RewriteCond %{QUERY_STRING} ^(.*)$
  37. RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$6
  38. #群组主题列表页伪静态
  39. RewriteCond %{QUERY_STRING} ^(.*)$
  40. RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=group&fid=$2&page=$3&$5
  41. #用户个人主页伪静态
  42. RewriteCond %{QUERY_STRING} ^(.*)$
  43. RewriteRule ^(.*)/space-(username|uid)-(.+)\.html(\?(.*))*$ $1/home\.php\?mod=space&$2=$3&$5
  44. #用户日志内容页伪静态
  45. RewriteCond %{QUERY_STRING} ^(.*)$
  46. RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/home\.php\?mod=space&uid=$2&do=blog&id=$3&$5
  47. #论坛 Archiver 页伪静态
  48. RewriteCond %{QUERY_STRING} ^(.*)$
  49. RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html(\?(.*))*$ $1/index\.php\?action=$2&value=$3&$5
  50. #插件伪静态
  51. RewriteCond %{QUERY_STRING} ^(.*)$
  52. RewriteRule ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html(\?(.*))*$ $1/plugin\.php\?id=$2:$3&$5
复制代码
httpd.conf规则设置:
  1. [ISAPI_Rewrite]

  2. # 3600 = 1 hour
  3. CacheClockRate 3600

  4. RepeatLimit 32

  5. # Protect httpd.ini and httpd.parse.errors files
  6. # from accessing through HTTP
  7. RewriteRule ^(.*)/topic-(.+)\.html(\?(.*))*$ $1/portal\.php\?mod=topic&topic=$2&$4
  8. RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/portal\.php\?mod=view&aid=$2&page=$3&$5
  9. RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3&$5
  10. RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$6
  11. RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=group&fid=$2&page=$3&$5
  12. RewriteRule ^(.*)/space-(username|uid)-(.+)\.html(\?(.*))*$ $1/home\.php\?mod=space&$2=$3&$5
  13. RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/home\.php\?mod=space&uid=$2&do=blog&id=$3&$5
  14. RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html(\?(.*))*$ $1/index\.php\?action=$2&value=$3&$5
  15. RewriteRule ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html(\?(.*))*$ $1/plugin\.php\?id=$2:$3&$5
复制代码
(2)服务器系统及 PHP : Linux / PHP v5.X.X  服务器软件:Apache
.htaccess的规则配置:
  1. <IfModule mod_rewrite.c>
  2. # 将 RewriteEngine 模式打开
  3. RewriteEngine On

  4. ErrorDocument 404 /404/index.html

  5. RewriteCond %{HTTP_HOST} ^662p.com$ [NC]
  6. RewriteRule ^(.*)$ http://www.662p.com/$1 [R=301,L]

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

  9. # Rewrite 系统规则请勿修改
  10. RewriteEngine On

  11. RewriteCond %{QUERY_STRING} ^(.*)$
  12. RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
  13. #Discuz!门户专题伪静态
  14. RewriteCond %{QUERY_STRING} ^(.*)$
  15. RewriteRule ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topicid=$2&%1
  16. #论坛其他伪静态
  17. RewriteCond %{QUERY_STRING} ^(.*)$
  18. RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
  19. RewriteCond %{QUERY_STRING} ^(.*)$
  20. RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
  21. RewriteCond %{QUERY_STRING} ^(.*)$
  22. RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
  23. RewriteCond %{QUERY_STRING} ^(.*)$
  24. RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
  25. RewriteCond %{QUERY_STRING} ^(.*)$
  26. RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
  27. RewriteCond %{QUERY_STRING} ^(.*)$
  28. RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
  29. RewriteCond %{QUERY_STRING} ^(.*)$
  30. RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1
  31. #主题分类与分类信息伪静态
  32. RewriteCond %{QUERY_STRING} ^(.*)$
  33. RewriteRule ^type-(\w+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&typeid=$2&typeid=$2&filter=typeid&page=$3&%1
  34. RewriteCond %{QUERY_STRING} ^(.*)$
  35. RewriteRule ^sort-(\w+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&sortid=$2&sortid=$2&filter=sortid&page=$3&%1
  36. #插件伪静态
  37. RewriteCond %{QUERY_STRING} ^(.*)$
  38. RewriteRule ^([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ plugin.php?id=$1:$2&%1
  39. </IfModule>
复制代码
发表于 2014-2-2 11:59:16 | 显示全部楼层
元芳你怎么看?
发表于 2014-2-2 21:54:02 | 显示全部楼层
这个不错啊:D:D:D:D:D:D
发表于 2014-2-3 15:57:24 | 显示全部楼层
我是个凑数的。。。
发表于 2014-2-3 16:14:15 | 显示全部楼层

发表于 2014-2-3 16:45:04 | 显示全部楼层
锄禾日当午,发帖真辛苦。谁知坛中餐,帖帖皆辛苦!
发表于 2014-2-3 23:22:58 | 显示全部楼层
占位编辑
发表于 2014-2-5 09:29:11 | 显示全部楼层
楼下的接上

新浪微博达人勋

发表于 2014-6-20 22:28:06 | 显示全部楼层
这个不错,实用!
发表于 2014-6-30 18:49:41 | 显示全部楼层
求沙发
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆



Archiver|  

662p开源网. Powered by Niuzen

© 2001-2014 Niuzen Inc.

返回顶部