请选择 进入手机版 | 继续访问电脑版

Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
?考试中心 ?帮助中心

4. 伪静态

本插件支持伪静态,要使用伪静态功能必须做到两点:
1.在论坛后台的应用中心开启伪静态: Discuz后台-->应用中心-->考试中心-->是否开启伪静态
2.根据服务器类型将下面一种合适的规则添加到服务器的伪静态文件中
注: 建议将此规则放在Discuz规则之前, 以防止与Discuz最后一条通用规则冲突
Apache Web Server(独立主机用户):
RewriteCond %QUERY_STRING ^(.*)$
RewriteRule ^(.*)/m/?$ $1/plugin.php?id=exam:m&mobile=no&%1
RewriteCond %QUERY_STRING ^(.*)$
RewriteRule ^(.*)/exam([0-9]*)\.html$ $1/plugin.php?id=exam&paper=$2.html&%1
RewriteCond %QUERY_STRING ^(.*)$
RewriteRule ^(.*)/test([0-9]*)\.html#?(\d*)$ $1/plugin.php?id=exam&test=$2.html#$3&%1
RewriteCond %QUERY_STRING ^(.*)$
RewriteRule ^(.*)/list([0-9]*)-?([0-9]*)\.html$ $1/plugin.php?id=exam&list=$2-$3.html&%1
Apache Web Server(虚拟主机用户):
RewriteCond %QUERY_STRING ^(.*)$
RewriteRule ^m/?$ plugin.php?id=exam:m&mobile=no&%1
RewriteCond %QUERY_STRING ^(.*)$
RewriteRule ^exam([0-9]*)\.html$ plugin.php?id=exam&paper=$1.html&%1
RewriteCond %QUERY_STRING ^(.*)$
RewriteRule ^test([0-9]*)\.html#?(\d*)$ plugin.php?id=exam&test=$1.html#$2&%1
RewriteCond %QUERY_STRING ^(.*)$
RewriteRule ^list([0-9]*)-?([0-9]*)\.html$ plugin.php?id=exam&list=$1-$2.html&%1
IIS Web Server(独立主机用户):
RewriteRule ^(.*)/m/?\?(.*)*$ $1/plugin\.php\?id=exam:m&mobile=no&$2
RewriteRule ^(.*)/exam([0-9]*)\.html\?(.*)*$ $1/plugin\.php\?id=exam&paper=$2.html&$3
RewriteRule ^(.*)/test([0-9]*)\.html#?(\d*)\?(.*)*$ $1/plugin\.php\?id=exam&test=$2.html#$3&$4
RewriteRule ^(.*)/list([0-9]*)-?([0-9]*)\.html\?(.*)*$ $1/plugin\.php\?id=exam&list=$2-$3.html&$4
IIS7 Web Server(独立主机用户):
<rule name="exam_m">
    <match url="^(.*/)*m/?$" />
    <action type="Rewrite" url="{R:1}/plugin.php\?id=exam:m&amp;mobile=no" />
</rule>
<rule name="exam_paper">
    <match url="^(.*/)*exam([0-9]*).html\?*(.*)$" />
    <action type="Rewrite" url="{R:1}/plugin.php\?id=exam&amp;paper={R:2}.html&amp;{R:3}" />
</rule>
<rule name="exam_test">
    <match url="^(.*/)*test([0-9]*).html#?(\d*)\?*(.*)$" />
    <action type="Rewrite" url="{R:1}/plugin.php\?id=exam&amp;test={R:2}.html#{R:3}&amp;{R:4}" />
</rule>
<rule name="exam_list">
    <match url="^(.*/)*list([0-9]*)-?([0-9]*).html#?(\d*)\?*(.*)$" />
    <action type="Rewrite" url="{R:1}/plugin.php\?id=exam&amp;list={R:2}-{R:3}.html{R:4}&amp;{R:5}" />
</rule>
Zeus Web Server:
match URL into $ with ^(.*)/m/?$
if matched then
    set URL = $1/plugin.php?id=exam:m&mobile=no
endif
match URL into $ with ^(.*)/exam([0-9]*)\.html\?*(.*)$
if matched then
    set URL = $1/plugin.php?id=exam&paper=$2.html&$3
endif
match URL into $ with ^(.*)/test([0-9]*)\.html#?(\d*)\?*(.*)$
if matched then
    set URL = $1/plugin.php?id=exam&test=$2.html#$3&$4
endif
match URL into $ with ^(.*)/list([0-9]*)-?([0-9]*)\.html\?*(.*)$
if matched then
    set URL = $1/plugin.php?id=exam&list=$2-$3.html&$4
endif
Nginx Web Server:
rewrite ^([^\.]*)/m/?$ $1/plugin.php?id=exam:m last;
rewrite ^([^\.]*)/exam([0-9]*)\.html$ $1/plugin.php?id=exam&paper=$2.html last;
rewrite ^([^\.]*)/test([0-9]*)\.html#?(\d*)$ $1/plugin.php?id=exam&test=$2.html#$3 last;
rewrite ^([^\.]*)/list([0-9]*)-?([0-9]*)?\.html$ $1/plugin.php?id=exam&list=$2-$3.html last;

Archiver|手机版|小黑屋|Comsenz Inc.

GMT+8, 2020-11-25 15:51 , Processed in 0.022734 second(s), 5 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

返回顶部