search
HomeCMS TutorialDEDECMSHow to set up pseudo-static in DEDECMS 5.7

How to set up pseudo-static in DEDECMS 5.7

Nov 09, 2019 pm 03:35 PM
dedecmsPseudo-static

How to set up pseudo-static in DEDECMS 5.7

DEDECMS 5.7伪静态怎么设置

织梦内容管理系统(DedeCms) 以简单、实用、开源而闻名,是国内最知名的PHP开源网站管理系统,也是使用用户最多的PHP类CMS系统,dedecms5.7功能更强大和实用,但是一些朋友对dede5.7的伪静态设置不是很熟悉,下面,就为大家分享一下dede5.7伪静态的设置方法。(推荐教程:dedecms教程)

第一步、后台-系统参数-核心设置-是否使用伪静态:选择“是”;

注:你的网站空间是否支持伪静态,你可以与空间的IDC商联系一下,如果是自己的服务器,那就更好办了,自己动手,丰衣足食。一般来说,空间都是支持伪静态的。Apache服务器伪静态相对简单,直接在.htaccess文件中加入相应伪静态规则即可;而IIS服务器伪静态的实现,则需要加载Rewrite组件,然后配置httpd.ini文件。 

第二步、如果你的网站已经存在生成的静态栏目或文章HTML,那么只需在后台-系统-SQL命令行工具中执行如下语句:

将所有文档设置为“仅动态浏览”:

update dede_archives set ismake=-1

将所有栏目设置为“使用动态页”:

update dede_arctype set isdefault=-1

第三步、列表页、文章页伪静态修改

打开/include/helpers/channelunit.helper.php。

(1)查找:

//动态文章
if($cfg_rewrite == 'Y')
{
    return $GLOBALS["cfg_plus_dir"]."/view-".$aid.'-1.html';
}

替换为

//动态文章
if($cfg_rewrite == 'Y')
{
    return "/DedeCMS/DedeCMS5.7-".$aid.'-1.html';
}

意思是:将默认的/plus/view-1-1.html文章链接格式改为/DedeCMS/DedeCMS5.7-1-1.html。

(2) 查找:

//动态
$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;

替换为

//动态
$reurl = "/category/list-".$typeid.".html";

意思是:将默认的频道或是列表页URL/plus//list.php?tid=1变更为/dedecms/list-1.html形式。

第四步、列表分页伪静态修改

打开/include/arc.listview.class.php

查找:

$plist = str_replace('.php?tid=', '-', $plist);

替换为

$plist = str_replace('plus/list.php?tid=', ‘DedeCMS/DedeCMS5.7-', $plist);

将默认的plus/list.php?tid=替换成RMB/list-;

意思是:将默认的列表分页链接格式plus/list.php?tid=x$x$xl修改为DedeCMS/DedeCMS5.7-x-x-x.html。

第五步、文章分页伪静态

打开/include/arc.archives.class.php,找到获取动态的分页列表GetPagebreakDM()函数末尾处:

查找:

$PageList = str_replace("plus/view.php?tid=","DedeCMS/DedeCMS5.7-",$PageList);

替换为

$plist = str_replace('plus/view.php?tid=', ’DedeCMS/DedeCMS5.7-', $plist);

将默认的plus/view.php?tid=替换成RMB/huilv-;

意思是:将默认的文章分页链接格式plus/view.php?tid=x$x$xl修改为DedeCMS/DedeCMS5.7-x-x-x.html

第六步、TAG标签伪静态

DedeCms默认的TAG标签URL,形如/tags.php?/dedecms模板 /,是不是觉得有个问号不怎么爽,我们改成/tags/dedecms模板 /,是不是好看多了。

下面我们来改一下,打开/include/taglib/tag.lib.php:

查找:

$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";

替换为

$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword'])."/";

这样就修改好了,上传你到你的网站,切记:要记得将原网站备份哦!!

第七步、httpd.ini伪静态规则:

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteRule ^(.*)/RMB/list-([0-9]+)\.html $1/plus/list\.php\?tid=$2 [I]
RewriteRule ^(.*)/RMB/list-([0-9]+)-([0-9]+)-([0-9]+)\.html $1/plus/list\.php\?tid=$2&TotalResult=$3&PageNo=$4 [I]
RewriteRule ^(.*)/RMB/huilv-([0-9]+)-([0-9]+)\.html $1/plus/view\.php\?arcID=$2&pageno=$3 [I]
RewriteRule ^(.*)/(.*)_(.*)_([0-9]+)\.html $1/huilv/?from=$2&to=$3&num=$4 [I]
RewriteRule ^(.*)/tags\.html $1/tags\.php [I]
RewriteRule ^(.*)/tags/(.*)(?:(\?.*))* $1/tags\.php\?\/$2 [I]
RewriteRule ^(.*)/tags/(.*)\/(?:(\?.*))* $1/tags\.php\?\/$2\/ [I]
RewriteRule ^(.*)/tags/(.*)\/([0-9])(?:(\?.*))* $1/tags\.php\?\/$2\/$3 [I]
RewriteRule ^(.*)/tags/(.*)\/([0-9])\/(?:(\?.*))* $1/tags\.php\?\/$2\/$3\/ [I]

将上面代码保存为:httpd.ini 上传到网站的根目录。

如无特特殊需求建议采用官方默认的生成静态的页面方式浏览。

The above is the detailed content of How to set up pseudo-static in DEDECMS 5.7. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)