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

CloudCone:洛杉矶MC机房KVM月付1.99美元起,支持支付宝/PayPal

CloudCone是一家成立于2017年的国外VPS主机商,提供独立服务器租用和VPS主机,其中VPS基于KVM架构,多个不同系列,譬如常规VPS、大硬盘VPS等等,数据中心在洛杉矶MC机房。商家2021年Flash Sale活动继续,最低每月1.99美元,支持7天退款到账户,支持使用PayPal或者支付宝付款,先充值后下单的方式。下面列出几款VPS主机配置信息。CPU:1core内存:768MB...

无忧云:洛阳BGP云服务器低至38.4元/月起;雅安高防云服务器/高防物理机优惠

无忧云怎么样?无忧云,无忧云是一家成立于2017年的老牌商家旗下的服务器销售品牌,现由深圳市云上无忧网络科技有限公司运营,是正规持证IDC/ISP/IRCS商家,主要销售国内、中国香港、国外服务器产品,线路有腾讯云国外线路、自营香港CN2线路等,都是中国大陆直连线路,非常适合免备案建站业务需求和各种负载较高的项目,同时国内服务器也有多个BGP以及高防节点。一、无忧云官网点击此处进入无忧云官方网站二...

Hostiger 16G大内存特价VPS:伊斯坦布尔机房,1核50G SSD硬盘200Mbps带宽不限流量$59/年

国外主机测评昨天接到Hostigger(现Hostiger)商家邮件推送,称其又推出了一款特价大内存VPS,机房位于土耳其的亚欧交界城市伊斯坦布尔,核50G SSD硬盘200Mbps带宽不限月流量只要$59/年。 最近一次分享的促销信息还是5月底,当时商家推出的是同机房同配置的大内存VPS,价格是$59.99/年,不过内存只有10G,虽然同样是大内存,但想必这次商家给出16G,价格却是$59/年,...

discuz 伪静态为你推荐
weipin唯品会的唯品钱包里的钱怎么用伪装微信地理位置微信地理位置伪装软件怎么定位到微信拂晓雅阁现在最流行的系统是那个???百度抢票浏览器百度浏览器怎么抢票?依赖注入依赖注入到底是为了解决什么问题的pwPW考试是指什么如何建立一个网站怎样能创建一个网站畅想中国用“心系祖国情,畅想中国梦”为题目的800字作文创维云电视功能谁能具体介绍一下创维云电视的主要功能,以及基本的使用方式,如果能分型号介绍就更好了,O(∩_∩)O谢谢ios系统苹果手机的系统是什么?
网络服务器租用 双线vps 抗投诉vps主机 krypt 瓦工 京东商城双十一活动 php空间申请 有奖调查 服务器是干什么的 美国免费空间 福建铁通 美国十大啦 symantec pptpvpn 德国代理 遨游论坛 西安电信测速网 流媒体服务器软件 新浪轻博客 文件服务器硬件配置 更多