让新版WeCenter更好用的秘诀(开启缓存、伪静态设置等教程)

君笑尘
君笑尘 这家伙很懒,还没有设置简介

2 人点赞了该文章 · 1848 浏览

让新版WeCenter更好用的秘诀

1.设置缓存

打开 后台->系统配置->优化配置,设置首页和列表的缓存。

如果你的网站更新内容很少,或者每次只有你自己更新,那么你可以把数字往大了设置,设置后以后,你会发现你网站首页的打开速度,提升了N倍!!!



2.伪静态

设置伪静态,可以让你的网站更好的被收录,Url也更美观。

如果要开启伪静态,那么你需要先在服务器上进行设置。

以宝塔上的nginx 为例子,我们可以这样设置。



location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}

如果你是其他类型的服务器,可以参考一下我之前发的文章。


服务器上配置好以后,我们 打开 后台->系统配置->站点配置,找到 URL重写,并开启和设置规则。这里建议设置和旧版本的网站规则一样,这样才不会影响到百度收录



例如旧版官方社区的配置,那么需要把伪静态设置成这样,才能无缝切换过来

explore/[:sort]===index/index
question/:id-[:answer][:sort]===question/detail
questions/[:sort]-[:category_id]===question/index
article/:id===article/detail
articles/[:sort]-[:category_id]===article/index
publish/question/[:id]===question/publish
publish/article/[:id]===article/publish
columns/[:page]===column/index
column/detail/:id===column/detail
c/collect/:id===column/collect
topics/[:type]-[:page]===topic/index
topic/:id-[:type]-[:sort]===topic/detail
actions/logs===topic/logs
select/topic===topic/select
remove/topic/[:id]===topic/remove_topic
manager/topic/[:id]===topic/manager
people/:name/[:type]===people/index
peoples/[:page]===people/lists
creator/===creator/index
actions/article/[:article_id]-[:type]-[:is_recommend]===article/action
remove/article/[:id]===article/remove_article
preview/article===article/preview
answer/save===question/save_answer
remove/question/[:id]===question/remove_question
actions/question/[:id]-[:type]===question/manager

具体的要看你原先的网站伪静态是怎么设置的,需要付费的技术支持,可以找我。


如果你是新网站,或者新域名,那么可以不用考虑原来的设置,我们可以把url变得更简洁一些。

例如这几个例子:


q/:id-[:answer][:sort]===question/detail
a/:id===article/detail
c/:id===column/detail
t/:id-[:type]-[:sort]===topic/detail
p/:name/[:type]===people/index

这里我们简单的说一下,这些规则的设置有什么含义。例如:


如果我们不开启伪静态,那么我们默认的链接是  https://zhanzhang.junxiaochen.com/question/detail.html?id=1 ,

其中我们的URL规则里,===question/detail ,代表的就是我们链接中,域名后面的路径。


如果我们开启了伪静态,并把问答详情的规则这样设置:

q/:id-[:answer][:sort]===question/detail

那么我们原来的链接就会变成 https://zhanzhang.junxiaochen.com/q/1.html


q/:id-[:answer][:sort]  就是把原来的链接 question/detail.html?id=1 ,重新定义为 /q/1.html 的形式访问。

如果这个链接带有答案id的话,就会变成 https://zhanzhang.junxiaochen.com/q/1-222.html 这样的形式。


如果我们把伪静态设置为这样:

question/:id-[:answer][:sort]===question/detail

那么我们原来的链接就会变成 https://zhanzhang.junxiaochen.com/question/1.html


如果我们把伪静态设置为这样:

q/:id-[:answer][:sort]===question/detail

那么我们原来的链接就会变成 https://zhanzhang.junxiaochen.com/q/1.html


如果我们把伪静态设置为这样:

ask/:id-[:answer][:sort]===question/detail

那么我们原来的链接就会变成 https://zhanzhang.junxiaochen.com/ask/1.html。


具体的,就根据你的运营需求,自己定义吧!


发布于 2022-05-31 22:42

免责声明:

本文由 君笑尘 原创发布于 WeCenter ,著作权归作者所有。

登录一下,更多精彩内容等你发现,贡献精彩回答,参与评论互动

登录! 还没有账号?去注册

gaxun
2022-07-05 21:22
324324
技术-安辰
2022-06-01 11:30
您用心了
pp336
2022-06-05 12:07
什么时候发布
pp336
2022-06-05 12:07
什么时候发布
团长
2022-06-17 13:42
旧版默认的伪静态,转换过来还是打不开,奇怪
tester12
2023-01-10 03:49
@pp336 我现在准备好了