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

WHloud Date鲸云数据($9.00/月), 韩国,日本,香港

WHloud Date(鲸云数据),原做大数据和软件开发的团队,现在转变成云计算服务,面对海内外用户提供中国大陆,韩国,日本,香港等多个地方节点服务。24*7小时的在线支持,较为全面的虚拟化构架以及全方面的技术支持!官方网站:https://www.whloud.com/WHloud Date 韩国BGP云主机少量补货随时可以开通,随时可以用,两小时内提交退款,可在工作日期间全额原路返回!支持pa...

乐凝网络支持24小时无理由退款,香港HKBN/美国CERA云服务器,低至9.88元/月起

乐凝网络怎么样?乐凝网络是一家新兴的云服务器商家,目前主要提供香港CN2 GIA、美国CUVIP、美国CERA、日本东京CN2等云服务器及云挂机宝等服务。乐凝网络提供比同行更多的售后服务,让您在使用过程中更加省心,使用零云服务器,可免费享受超过50项运维服务,1分钟内极速响应,平均20分钟内解决运维问题,助您无忧上云。目前,香港HKBN/美国cera云服务器,低至9.88元/月起,支持24小时无理...

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...

discuz 伪静态为你推荐
主页改不了浏览器主页改不了 怎么办啊windows优化大师怎么用Windows优化大师怎么用缓冲区溢出教程哪里可以下载黑客教程,详细网址,镜像文件是什么什么叫镜像文件,作用是什么?开机滚动条谁会调开机的滚动条虚拟专用网拨号网络与虚拟专用网的区别srv记录exchange 2010 自动发现需不需要srv记录宽带接入服务器用wifi连不上服务器怎么办微信怎么看聊天记录微信如何查找聊天记录聚美优品红包聚美优品怎么给别人发红包
花生壳动态域名 hostigation 堪萨斯服务器 搬瓦工官网 cpanel sugarsync kddi wordpress技巧 sockscap 英文简历模板word 网站保姆 evssl证书 500m空间 日本bb瘦 工作站服务器 亚马逊香港官网 qq云端 33456 万网主机管理 丽萨 更多