现在的位置: 首页 > 综合 > 正文

Discuz X2站点URL静态化(修改.htaccess文件设置Rewrite规则)

2013年08月04日 ⁄ 综合 ⁄ 共 1310字 ⁄ 字号 评论关闭
  1. # 将 RewriteEngine 模式打开  
  2. RewriteEngine On  
  3.   
  4. # 修改以下语句中的 /discuz 为你的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 /  
  5. RewriteBase /discuz  
  6.   
  7. # Rewrite 系统规则请勿修改  
  8. RewriteCond %{QUERY_STRING} ^(.*)$  
  9. RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1  
  10. RewriteCond %{QUERY_STRING} ^(.*)$  
  11. RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1  
  12. RewriteCond %{QUERY_STRING} ^(.*)$  
  13. RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1  
  14. RewriteCond %{QUERY_STRING} ^(.*)$  
  15. RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1  
  16. RewriteCond %{QUERY_STRING} ^(.*)$  
  17. RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1  
  18. RewriteCond %{QUERY_STRING} ^(.*)$  
  19. RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1  
  20. RewriteCond %{QUERY_STRING} ^(.*)$  
  21. RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1  
  22. RewriteCond %{QUERY_STRING} ^(.*)$  
  23. RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1  

1.此为Apache Web Server(虚拟主机用户),注意修改RewriteBase,最后保存为.htaccess

2.上传到你的Discuz程序所在的目录

3.修改discuz x2 - seo设置 - 把所有项选择为可用,Rewrite兼容性选否。

以上为hawkhost设置

转载自:http://blog.csdn.net/poechant/article/details/6732222

抱歉!评论已关闭.