参看这个博客:
http://hi.baidu.com/zwfec/item/cdd19716e77e225f2b3e2242
或者
http://www.jb51.net/article/15602.htm
或者
http://jingyan.baidu.com/article/afd8f4de50db9934e286e9a7.html
而对于将discuz安装在非根目录的话,需要在所安装的目录下添加一个.htaccess的文件,
文件的内容参考, http://www.panjieseo.com/235.html,具体可以如下:
RewriteEngine On
RewriteBase /bbs
# Rewrite 系统规则请勿修改
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?
mod=view&aid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?
mod=forumdisplay&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?
mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?
mod=group&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^([a-z]+)-(.+)\.html$ $1.php?rewrite=$2&%1
注意:不用修改。
此外,若是根目录的网站是用框架搭建的话,往往还需要修改根目录下 .htaccess的文件
内容,例如采用Thinkphp的话,需要做如下的修改:
RewriteEngine On
#添加的东西
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^forum.php(.*)$ /forum/forum.php$1 [QSA,PT]
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^home.php(.*)$ /forum/home.php$1 [QSA,PT]
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^portal.php(.*)$ /forum/portal.php$1 [QSA,PT]
#添加的东西 结束
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]