Discuz怎样根据服务器环境配置对应的伪静态
1个回答
展开全部
一、服务器系统及 PHP:WINNT / PHP v5.X.X 服务器软件:Microsoft-IIS/6.0
这种环境对应的是IIS Web Server(独立主机用户),对应的规则为:
[ISAPI_Rewrite] # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 # Protect httpd.ini and httpd.parse.errors files # from accessing through HTTP RewriteRule ^(.*)/topic-(.+)\.html(\?(.*))*$ $1/portal\.php\?mod=topic&topic=$2&$4 RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/portal\.php\?mod=view&aid=$2&page=$3&$5 RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3&$5 RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=viewthread&tid=$2&extra=page\=$4&page=$3&$6 RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=group&fid=$2&page=$3&$5 RewriteRule ^(.*)/space-(username|uid)-(.+)\.html(\?(.*))*$ $1/home\.php\?mod=space&$2=$3&$5 RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/home\.php\?mod=space&uid=$2&do=blog&id=$3&$5 RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html(\?(.*))*$ $1/index\.php\?action=$2&value=$3&$5
二、服务器系统及 PHP:WINNT / PHP v5.2.16 服务器软件:Microsoft-IIS/7.X
这种环境对应的是IIS7 Web Server(独立主机用户),对应的规则是:
三、服务器环境为服务器系统及 PHP : Linux / PHP v5.X.X 服务器软件:Apache
这种环境也就是无忧主机php空间的环境,对应的规则是:
RewriteEngine On # 修改以下语句中的 /discuz 为您的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 / RewriteBase /discuz # 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\=$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 ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1
四、服务器系统及 PHP : Linux / PHP v5.X.X 服务器软件:Nginx
这种环境对应的规则为:
rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last; rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last; rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last; rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page=$4&page=$3 last; rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last; rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last; rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last; rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last; if (!-e $request_filename) { return 404; }
以上四种,就是常见的四类环境,站长朋友们可以根据自己的环境来配置discuz伪静态。具体做法都是在配置文件中添加这些代码,然后后台开启伪静态功能,即可生效。希望对大家有所帮助。
这种环境对应的是IIS Web Server(独立主机用户),对应的规则为:
[ISAPI_Rewrite] # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 # Protect httpd.ini and httpd.parse.errors files # from accessing through HTTP RewriteRule ^(.*)/topic-(.+)\.html(\?(.*))*$ $1/portal\.php\?mod=topic&topic=$2&$4 RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/portal\.php\?mod=view&aid=$2&page=$3&$5 RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3&$5 RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=viewthread&tid=$2&extra=page\=$4&page=$3&$6 RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=group&fid=$2&page=$3&$5 RewriteRule ^(.*)/space-(username|uid)-(.+)\.html(\?(.*))*$ $1/home\.php\?mod=space&$2=$3&$5 RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/home\.php\?mod=space&uid=$2&do=blog&id=$3&$5 RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html(\?(.*))*$ $1/index\.php\?action=$2&value=$3&$5
二、服务器系统及 PHP:WINNT / PHP v5.2.16 服务器软件:Microsoft-IIS/7.X
这种环境对应的是IIS7 Web Server(独立主机用户),对应的规则是:
三、服务器环境为服务器系统及 PHP : Linux / PHP v5.X.X 服务器软件:Apache
这种环境也就是无忧主机php空间的环境,对应的规则是:
RewriteEngine On # 修改以下语句中的 /discuz 为您的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 / RewriteBase /discuz # 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\=$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 ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1
四、服务器系统及 PHP : Linux / PHP v5.X.X 服务器软件:Nginx
这种环境对应的规则为:
rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last; rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last; rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last; rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page=$4&page=$3 last; rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last; rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last; rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last; rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last; if (!-e $request_filename) { return 404; }
以上四种,就是常见的四类环境,站长朋友们可以根据自己的环境来配置discuz伪静态。具体做法都是在配置文件中添加这些代码,然后后台开启伪静态功能,即可生效。希望对大家有所帮助。
浙江启扬智能科技有限公司
2023-06-12 广告
2023-06-12 广告
Android和ARM、Linux之间存在密切的联系。Android是一种基于Linux内核的嵌入式智能操作系统,它采用了ARM处理器作为其主要处理器架构。Android的内核和许多应用程序都是基于ARM架构编写的,包括处理器和内存管理器。...
点击进入详情页
本回答由浙江启扬智能科技有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询