一个资源分享、信息整合的综合性站点。

标题: 织梦dedecms设置全站伪静态的方法 [打印本页]

作者: 树苗收集系    时间: 2020-9-16 11:43
标题: 织梦dedecms设置全站伪静态的方法
在让网站全部都是伪静态的时候首先就要确保自己的空间或服务器是不是支持伪静态,也就是url重写,如果支持的话才可以设置,否则是不能设置的。  

登陆织梦后台开始伪静态,在“系统”->“核心设置”->“是否使用伪静态”

首页伪静态

首先就要把站点根目录下的index.html删除,在以后更新的时候不要更新生成html文件就可以了  

设置栏目和文章就在栏目列表选项中选择使用动态页浏览,在文章发布的时候也选择仅动态浏览。  

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

将GetFileName()中的如下代码:

  1. //动态文章
  2. if($cfg_rewrite == 'Y')
  3. {
  4. return $GLOBALS["cfg_plus_dir"]."/view-".$aid.'-1.html';
  5. }
复制代码
替换为
  1. <span style="background-color: rgb(255, 255, 255);">//动态文章</span>
复制代码

将文章页默认的 /plus/view-1-1.html链接格式改为 /archives/view-1-1.html

将GetTypeUrl()中的如下代码:
  1. //动态
  2. $reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
复制代码
替换为
  1. //动态
  2. $reurl = "/category/list-".$typeid.".html";
复制代码

将频道或是列表页URL变更为/category/list-1.html形式。

列表分页伪静态

打开/include/arc.listview.class.php,找到获取动态的分页列表GetPageListDM()函数末尾处:  
  1. $plist = str_replace('.php?tid=', '-', $plist);
复制代码
替换为  
  1. $plist = str_replace('plus', 'category', $plist);
复制代码

将默认的plus替换成  
  1. 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()函数末尾处:  

  1. $PageList = str_replace(".php?aid=","-",$PageList);
复制代码
替换为  
  1. $plist = str_replace('plus', 'archives', $plist);
复制代码

将默认的plus替换成  
  1. archives$PageList = str_replace(".php?aid=","-",$PageList);
复制代码

TAG标签伪静态

打开/include/taglib/tag.lib.php,找到lib_tag()函数下的:  
  1. $row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";
复制代码
替换为  
  1. $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?”即可。


作者: 采女孩的大蘑菇    时间: 2020-9-22 22:52
不错不错 支持下
作者: 天使爱上吸血鬼    时间: 2020-10-8 20:37
前来支持~~~~~~~~~~~~~~~~~~~




欢迎光临 一个资源分享、信息整合的综合性站点。 (http://www.sorv.cn/) Powered by Discuz! X3.4