栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP > php开源框架 > dedecms

DedeCMS织梦网站全站伪静态

dedecms 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

DedeCMS织梦网站全站伪静态

在让网站全部都是伪静态的时候首先就要确保自己的空间或服务器是不是支持伪静态,也就是url重写,如果支持的话才可以设置,否则是不能设置的。
登陆织梦后台开始伪静态,在“系统”->“核心设置”->“是否使用伪静态”

首页伪静态

首先就要把站点根目录下的index.html删除,在以后更新的时候不要更新生成html文件就可以了
设置栏目和文章就在栏目列表选项中选择使用动态页浏览,在文章发布的时候也选择仅动态浏览。
打开/include/helpers/channelunit.helper.php
将GetFileName()中的如下代码: //动态文章
if($cfg_rewrite == 'Y')
{
return $GLOBALS["cfg_plus_dir"]."/view-".$aid.'-1.html';
}
替换为 //动态文章
if($cfg_rewrite == 'Y')
{
return "/archives/view-".$aid.'-1.html';
}
将文章页默认的 /plus/view-1-1.html链接格式改为 /archives/view-1-1.html
将GetTypeUrl()中的如下代码: //动态
$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
替换为 //动态
$reurl = "/category/list-".$typeid.".html";
将频道或是列表页URL变更为/category/list-1.html形式。

列表分页伪静态

打开/include/arc.listview.class.php,找到获取动态的分页列表GetPageListDM()函数末尾处:
$plist = str_replace('.php?tid=', '-', $plist);
替换为
$plist = str_replace('plus', 'category', $plist);
将默认的plus替换成
category$plist = str_replace('.php?tid=', '-', $plist);
将列表分页默认链接格式 /plus/list-1-2-1.html修改为/category/list-1-2-1.html
DEDECMS文章分页伪静态
打开/include/arc.archives.class.php,找到获取动态的分页列表GetPagebreakDM()函数末尾处:
$PageList = str_replace(".php?aid=","-",$PageList);
替换为
$plist = str_replace('plus', 'archives', $plist);
将默认的plus替换成
archives$PageList = str_replace(".php?aid=","-",$PageList);

TAG标签伪静态

打开/include/taglib/tag.lib.php,找到lib_tag()函数下的:
$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";
替换为
$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword'])."/";
搜索伪静态
一种偷懒的方法,将搜索URL中“search.php?…”直接替换为“search.html?…”,至于“?”号之后的参数以任意字符进行匹配。
依次打开include文件夹下的channelunit.func.php、arc.searchview.class.php、arc.taglist.class.php以及/include/taglib/hotwords.lib.php,查找“search.php?”替换为“search.html?”即可。 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/5421.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号