代码人»首页 技术广场 Discuz! 查看内容

阿里云虚拟主机建站discuz3.5开启伪静态

314

主题

2

回帖

1309

积分

管理员

积分
1309
开启伪静态步骤:

步骤1.进入网站后台--->全局--->SEO设置--->URL 静态化

步骤2.URL 静态化下方的右侧复选框全部勾选

步骤3.点击查看URL 静态化右侧的“查看当前的 Rewrite 规则"

类型:
①Apache Web Server(独立主机用户)

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{QUERY_STRING} ^(.*)$
        ... ...
</IfModule>


②.Apache Web Server(虚拟主机用户)

# 将 RewriteEngine 模式打开
RewriteEngine On

# 如 www.discuz.vip/bbs/,对应的就是 RewriteBase /bbs/,如果程序放在根目录中,使用 RewriteBase /
RewriteBase /

# Rewrite 系统规则请勿修改
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
... ...
RewriteRule ^([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ plugin.php?id=$12&%1

③.Nginx Web Server

rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
... ...
rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$23 last;
if (!-e $request_filename) {
        return 404;
}

④.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 ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html(\?(.*))*$ $1/plugin\.php\?id=$23&$5

⑤.IIS7 Web Server(独立主机用户)
<rewrite>
        <rules>
                <rule name="portal_topic">
                   ... ...
                </rule>
        </rules>
</rewrite>

⑥.Lighttpd Web Server
url.rewrite-once = (
"(.*)/topic-(.+)\.html\?*(.*)$" => "$1/portal.php?mod=topic&topic=$2&$3",
"... ...
"(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html\?*(.*)$" => "$1/plugin.php?id=$23&$4",
)

⑦.Caddy Web Server
@portal_topic path_regexp portal_topic ^(.*)/topic-(.+)\.html$
rewrite @portal_topic {re.portal_topic.1}/portal.php?mod=topic&topic={re.portal_topic.2}&{query}
... ...
rewrite @plugin {re.plugin.1}/plugin.php?id={re.plugin.2}:{re.plugin.3}&{query}

步骤4.

来源:代码人网



微信扫一扫,分享更方便

付费看帖
剩余 4% 内容需要支付 5.00 元 后可完整阅读
支持付费阅读,激励作者创作更好的作品。会员可8折购买!

举报 回复