静态Discuz! X3.0X3.1X3.2通用 伪静态设置和伪静态规则

discuz 伪静态  时间:2021-02-10  阅读:()

Discuz!X3.0/X3.1/X3.2通用伪静态设置和伪静态规则首先简单讲一下为什么要做伪静态伪静态是相对真实静态来讲的通常我们为了增强搜索引擎的友好面都将文章内容生成静态页面但是有的朋友为了实时的显示一些信息。或者还想运用动态脚本解决一些问题。不能用静态的方式来展示网站内容。但是这就损失了对搜索引擎的友好面。怎么样在两者之间找个中间方法呢这就产生了伪静态技术。就是展示出来的是以html一类的静态页面形式这种html的显示形式更加有利于SEO。

现在开源程序越来越流行了很多新手站长在用Discuz程序搭建网站后会发现自己的网站地址是动态地址所谓动态地址就是带有号这种 比如http://www.xzzbbs.com/forum.php?mod= · · ·这种就属于动态地址那么我们想要网站就行伪静态也就是以html结尾的网址该如何做呢

1.在后台“全局》 SEO设置》 URL静态化”相关复选框全部勾选点“提交”按钮。如下图

2.根据web服务器选择相应的伪静态规则

Apache Web Server(独立主机用户)

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteCond %{QUERY_STRING} ^ (.*)$

RewriteRule

^ (.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2&

%1

RewriteCond %{QUERY_STRING} ^ (.*)$

RewriteRule

^ (.*)/article-( [0-9]+)-( [0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3&%1

RewriteCond %{QUERY_STRING} ^ (.*)$

RewriteRule

^ (.*)/forum-(\w+)-( [0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&%1

RewriteCond %{QUERY_STRING} ^ (.*)$

RewriteRule

^ (.*)/thread-( [0-9]+)-( [0-9]+)-( [0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&%1

RewriteCond %{QUERY_STRING} ^ (.*)$

RewriteRule

^ (.*)/group-( [0-9]+)-( [0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3&%1

RewriteCond %{QUERY_STRING} ^ (.*)$

RewriteRule

^ (.*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3&%1

RewriteCond %{QUERY_STRING} ^ (.*)$

RewriteRule

^ (.*)/blog-( [0-9]+)-( [0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3&%1

RewriteCond %{QUERY_STRING} ^ (.*)$

RewriteRule

^ (.*)/(fid|tid)-( [0-9]+)\.html$ $1/index.php?action=$2&value=$3&%1

RewriteCond %{QUERY_STRING} ^ (.*)$

RewriteRule

^ (.*)/( [a-z]+[a-z0-9_]*)-( [a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3&%1

</IfModule>

Apache Web Server(虚拟主机用户)

#将RewriteEngine模式打开

RewriteEngine On

#修改以下语句中的/discuz为您的论坛目录地址如果程序放在根目录中请将/discuz修改为/

RewriteBase /discuz

# Rewrite系统规则请勿修改

RewriteCond %{QUERY_STRING} ^ (.*)$

RewriteRule

^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1RewriteCond %{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} ^ (.*)$

RewriteRulejwWm

^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&f id=$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

RewriteCond %{QUERY_STRING} ^ (.*)$

RewriteRule

^ ( [a-z]+[a-z0-9_]*)-( [a-z0-9_\-]+)\.html$ plugin.php?id=$1:$2&%1

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\%3D$4&page

=$3&$6

RewriteRule

^ (.*)/group-( [0-9]+)-( [0-9]+)\.html (\?(.*) )*$ $1/forum\.php\?mod=group&f id=$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

RewriteRule

^ (.*)/( [a-z]+[a-z0-9_]*)-( [a-z0-9_\-]+)\.html (\?(.*) )*$ $1/plugin\.php\?id=$2:$3&$5

IIS7 Web Server(独立主机用户)

<rewrite>

<rules>

<rule name="portal_topic">

<matchurl="^ (.*/)*topic-(.+) .html\?*(.*) [ DISCUZ_CODE_2

]quot; />

<action type="Rewrite"url="{R: 1}/portal.php\?mod=topic&topic={R:2}&{R:3}" />

</rule>

<rule name="portal_article">

<matchurl="^ (.*/)*article-( [0-9]+)-( [0-9]+) .html\?*(.*) [DISCUZ_CODE_2 ]quot; />

<action type="Rewrite"url="{R: 1}/portal.php\?mod=view&aid={R:2}&page={R:3}&{R:4}" />

</rule>

<rule name="forum_forumdisplay">

<matchurl="^ (.*/)*forum-(\w+)-( [0-9]+) .html\?*(.*) [ DISCUZ_CODE_2 ]quot; />

<action type="Rewrite"url="{R: 1}/forum.php\?mod=forumdisplay&fid={R:2}&page={R:3}&{R:4}" />

</rule>

<rule name="forum_viewthread">

jwWm

<matchurl="^ (.*/)*thread-( [0-9]+)-( [0-9]+)-( [0-9]+) .html\?*(.*)[ DISCUZ_CODE_2 ]quot; />

<action type="Rewrite"url="{R: 1}/forum.php\?mod=viewthread&tid={R:2}&extra=page%3D{R:4}&page={R:3}&{R:5}" />

</rule>

<rule name="group_group">

<matchurl="^ (.*/)*group-( [0-9]+)-( [0-9]+) .html\?*(.*) [ DISCUZ_CODE_2 ]quot; />

<action type="Rewrite"url="{R: 1}/forum.php\?mod=group&f id={R:2}&page={R:3}&{R:4}" />

</rule>

<rule name="home_space">

<matchurl="^ (.*/)*space-(username|uid)-(.+) .html\?*(.*) [

DISCUZ_CODE_2 ]quot; />

<action type="Rewrite"url="{R: 1}/home.php\?mod=space&{R:2}={R:3}&{R:4}" />

</rule>

<rule name="home_blog">

<matchurl="^ (.*/)*blog-( [0-9]+)-( [0-9]+) .html\?*(.*) [ DISCUZ_CODE_2 ]quot; />

<action type="Rewrite"url="{R: 1}/home.php\?mod=space&uid={R:2}&do=blog&id={R:3}&{R:4}" />

</rule>

<rule name="forum_archiver">

<matchurl="^ (.*/)*(fid|tid)-( [0-9]+) .html\?*(.*) [ DISCUZ_CODE_2 ]quot; />

<action type="Rewrite"url="{R: 1}/index.php\?action={R:2}&value={R:3}&{R:4}" />

</rule>

<rule name="plugin">

<matchurl="^ (.*/)*( [a-z]+[a-z0-9_]*)-( [a-z0-9_\-]+) .html\?*(.*)[ DISCUZ_CODE_2 ]quot; />

<action type="Rewrite"url="{R: 1}/plugin.php\?id={R:2} : {R:3}&{R:4}" />

</rule>

</rules>

</rewrite>

Zeus Web Servermatch URL into $ with ^ (.*)/topic-(.+)\.html\?*(.*)$if matched thenset URL = $1/portal.php?mod=topic&topic=$2&$3endifmatch URL into $ with

^ (.*)/article-( [0-9]+)-( [0-9]+)\.html\?*(.*)$if matched thenset URL= $1/portal.php?mod=view&aid=$2&page=$3&$4endifmatch URL into $ with

^ (.*)/forum-(\w+)-( [0-9]+)\.html\?*(.*)$if matched thenset URL =

$1/forum.php?mod=forumdisplay&f id=$2&page=$3&$4endifmatch URL into $ with

^ (.*)/thread-( [0-9]+)-( [0-9]+)-( [0-9]+)\.html\?*(.*)$if matched thenset URL =

$1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$5endifmatch URL into $ with

^ (.*)/group-( [0-9]+)-( [0-9]+)\.html\?*(.*)$if matched thenset URL= $1/forum.php?mod=group&fid=$2&page=$3&$4endifmatch URL into $ with

^ (.*)/space-(username|uid)-(.+)\.html\?*(.*)$if matched thenset URL = $1/home.php?mod=space&$2=$3&$4endifmatch URL into $ with

^ (.*)/blog-( [0-9]+)-( [0-9]+)\.html\?*(.*)$if matched thenset URL =

$1/home.php?mod=space&uid=$2&do=blog&id=$3&$4endifmatch URL into $ with

^ (.*)/(fid|tid)-( [0-9]+)\.html\?*(.*)$jwWm

if matched thenset URL = $1/index.php?action=$2&value=$3&$4endifmatch URL into $ with

^ (.*)/( [a-z]+[a-z0-9_]*)-( [a-z0-9_\-]+)\.html\?*(.*)$if matched thenset URL = $1/plugin.php?id=$2:$3&$4endif

Nginx Web Serverrewrite

^ ( [^\. ]*)/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%3D$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;rewrite

^ ( [^\. ]*)/( [a-z]+[a-z0-9_]*)-( [a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;if (!-e $request_filename) {return 404;

}

3.在网站根目录建立.htaccess文件把伪静态规则复制进去保存。

PS部分伪静态规则里有目录选择默认目录是/discuz如果其他目录的话修改第2行“RewriteBase /discuz” 把discuz换成目录名,如在bbs目录则改为

RewriteBase /bbs .htaccess文件放在bbs目录

附上新站长论坛所使用的伪静态规则一般站点都可以使用。[attach]41 [/attach]jwWm

ZJI韩国BGP+CN2服务器,440元起

ZJI又上新了!商家是原Wordpress圈知名主机商:维翔主机,成立于2011年,2018年9月启用新域名ZJI,提供中国香港、台湾、日本、美国独立服务器(自营/数据中心直营)租用及VDS、虚拟主机空间、域名注册等业务。本次商家新上韩国BGP+CN2线路服务器,国内三网访问速度优秀,适用8折优惠码,优惠后韩国服务器最低每月440元起。韩国一型CPU:Intel 2×E5-2620 十二核二十四线...

2021HawkHost老鹰主机黑色星期五虚拟主机低至3.5折 永久4.5折

老鹰主机HawkHost是个人比较喜欢的海外主机商,如果没有记错的话,大约2012年左右的时候算是比较早提供支付宝付款的主机商。当然这个主机商成立时间更早一些的,由于早期提供支付宝付款后,所以受众用户比较青睐,要知道我们早期购买海外主机是比较麻烦的,信用卡和PAYPAL还没有普及,大家可能只有银联和支付宝,很多人选择海外主机还需要代购。虽然如今很多人建站少了,而且大部分人都用云服务器。但是老鹰主机...

妮妮云(30元),美国300G防御 2核4G 107.6元,美国高速建站 2核2G

妮妮云的来历妮妮云是 789 陈总 张总 三方共同投资建立的网站 本着“良心 便宜 稳定”的初衷 为小白用户避免被坑妮妮云的市场定位妮妮云主要代理市场稳定速度的云服务器产品,避免新手购买云服务器的时候众多商家不知道如何选择,妮妮云就帮你选择好了产品,无需承担购买风险,不用担心出现被跑路 被诈骗的情况。妮妮云的售后保证妮妮云退款 通过于合作商的友好协商,云服务器提供2天内全额退款,超过2天不退款 物...

discuz 伪静态为你推荐
绵阳电信绵阳电信宽带套餐资费推荐拂晓雅阁我对电脑操作不熟悉,想买一本自学的电脑书籍,是电脑入门那一类的,最好还有办公软件应用那一类的bluestacks安卓模拟器BlueStacks如何安装使用?伪静态什么是伪静态镜像文件是什么镜像文件是什么意思?安卓应用平台现在android平台的手机都有哪些?中小企业信息化信息化为中小企业发展带来了哪些机遇天天酷跑刷金币天天酷跑怎么刷金币?畅想中国畅想中国发展前景保护气球什么气球可以骑?
域名网站 免费vps 如何注册中文域名 2019年感恩节 仿牌空间 美国主机评测 香港主机 国外免费空间 创梦 双拼域名 免费全能主机 息壤代理 web服务器是什么 建站论坛 qq空间论坛 上海服务器托管 免费服务器代理 灵动鬼影实录4 杭州机动车摇号申请网站 网购分享吧 更多