静态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

BuyVM($5/月),1Gbps不限流量流媒体VPS主机

BuyVM针对中国客户推出了China Special - STREAM RYZEN VPS主机,带Streaming Optimized IP,帮你解锁多平台流媒体,适用于对于海外流媒体有需求的客户,主机开设在拉斯维加斯机房,AMD Ryzen+NVMe磁盘,支持Linux或者Windows操作系统,IPv4+IPv6,1Gbps不限流量,最低月付5加元起,比美元更低一些,现在汇率1加元=0.7...

NameCheap黑色星期五和网络礼拜一

如果我们较早关注NameCheap商家的朋友应该记得前几年商家黑色星期五和网络星期一的时候大促采用的闪购活动,每一个小时轮番变化一次促销活动而且限量的。那时候会导致拥挤官网打不开迟缓的问题。从去年开始,包括今年,NameCheap商家比较直接的告诉你黑色星期五和网络星期一为期6天的活动。没有给你限量的活动,只有限时六天,这个是到11月29日。如果我们有需要新注册、转入域名的可以参加,优惠力度还是比...

Puaex:香港vds,wtt套餐,G口带宽不限流量;可解流媒体,限量补货

puaex怎么样?puaex是一家去年成立的国人商家,本站也分享过几次,他家主要销售香港商宽的套餐,给的全部为G口带宽,而且是不限流量的,目前有WTT和HKBN两种线路的方面,虽然商家的价格比较贵,但是每次补一些货,就会被抢空,之前一直都是断货的状态,目前商家进行了补货,有需要这种类型机器的朋友可以入手。点击进入:puaex商家官方网站Puaex香港vds套餐:全部为KVM虚拟架构,G口的带宽,可...

discuz 伪静态为你推荐
51自学网站网上自学网站有哪些?最好是免费的,我想学习网页设计真正免费的网络电话有没有真正免费的网络电话?而且是好用的?中国电信互联星空电信不明不白收了我200元互联星空信息费 求解怎么样免费装扮qq空间要怎么免费装扮QQ空间!依赖注入依赖注入是什么意思?镜像文件是什么系统镜像是什么办公协同软件免费的多人协同办公软件哪些,我了解的有钉钉、企业微信,其他的还有么?直播加速请问哪种播放器的可以播放加速,并且可以保存qq怎么发邮件如何通过QQ发送邮件ios7固件下载iOS7如何升级固件?
希网动态域名 awardspace mach softbank官网 windows2003iso 网站实时监控 警告本网站 国外免费空间 150邮箱 华为网络硬盘 骨干网络 刀片服务器是什么 idc资讯 静态空间 昆明蜗牛家 服务器监测 江苏双线服务器 免费mysql数据库 双12 免费asp空间 更多