DedeCms5.7伪静态教程
1.前提是空间支持伪静态
2.开开启DedeCms伪静态:后台-系统参数-核心设置-是否使用伪静态:选择“是”
3.创建栏目或批量增加栏目时,选择“使用动态页”
4.添加新文章时,发布选项:选择“仅动态浏览 ”。如果已经发布很多内容那么只需在后台-系统-SQL命令行工具中执行如下语句:
update dede_arctype set isdefault=-1;
update dede_archives set ismake=-1;
5.修改文件源码
(1).DedeCms首页伪静态:删除站点根目录下index.html.
(2).列表页DedeCms频道
V5.7,此文件路径更改了,你打开/include/helpers/channelunit.helper.php
将GetTypeUrl()中的如下代码:
//动态
$reurl = $GLOBALS['cfg_phpurl'].”/list.php?tid=”.$typeid;
替换为
//动态
$reurl = “/category/list-”.$typeid.”.html”;
(3).内容页面设置
V5.7,此文件路径更改了,你打开/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’;
}
6创建.htaccess文件,加入如下规则:
RewriteRule ^/category/list-([0-9]+).html$ /plus/list.php?tid=$1
RewriteRule ^/category/list-([0-9]+)-([0-9]+)-([0-9]+).html$ /plus/list.php?tid=$1&totalresult=$2&PageNo=$3
RewriteRule ^/archives/view-([0-9]+)-([0-9]+).html$ /plus/view.php?arcID=$1&pageno=$2