最新活动:电脑PC端+手机端+微网站+自适应网页多模板选择-建站388元起价!!!
要源码
当前位置:主页 > 网站建设 > 比较全面的dedecms织梦全站伪静态规则,织梦文章

比较全面的dedecms织梦全站伪静态规则,织梦文章

时间:2023-07-21 11:07:21 阅读: 文章分类: 网站建设 作者: 织梦编辑员

导读:织梦文章织梦文章dedecms(织梦)完美实现伪静态的方法dedecms(织梦)完美实现伪静态的方法测试版本:Dedecms V5.6版本测试平台:Windows 7测试环境:织梦首页模板dede58模板。

织梦首页模板dede58模板

dedecms(织梦)完美实现伪静态的方法

dedecms(织梦)完美实现伪静态的方法 测试版本:Dedecms V5.6版本 测试平台:Windows 7 测试环境:IIS 7.5 成功。其他条件下大同小异。 需要的条件: 1、服务器必须支持URL重写。 2、后台开启伪静态。 3、栏目设置使用动态。 4、添加文档时选择使用动态dede网站模板浏览。 5、修改php文件include/channelunit.func.php。 6、修改include/arc.listview.class.php。 7、编写rewrite规则。 操作步骤: 1、加载Rewrite模块(过程略)。 2、dedecms后台-系统-系统基本参数-核心设置-是否使用伪静态,选“是”。 3、把栏目和文档设置成为动态浏览。可以手动,用sql语句更快。 dedecms后台-SQL命令行工具,执行以下语句 将所有文档设置为“仅动态浏览”:update dede_archives set ismake=-1 将所有栏目设置为“使用动态页”:update dede_arctype set isdefault=-1 改成1就是静态。动态转换为静态后需要重新生成HTML。 添加栏目和文章默认为动态的一劳永逸的方法: 4、修改php文件include/channelunit.func.php 查找 return $GLOBALS["cfg_plus_dir"].”/view-”.$aid.’-1.html’; 修改为 return “/view-”.$aid.’-1.html’; 查找 return $GLOBALS['cfg_phpurl'].”/view.php?aid=$aid”; 修改为 return “/view.php?aid=$aid”; 其实页可以不修改,就是URL地址会长一点。这个是文章页的。 查找 $reurl = $GLOBALS['cfg_phpurl'].”/list.php?tid=”.$typeid; 修改为 $reurl = “/list-”.$typeid.”.html”; 这个必须修改,是栏目页的。 其实不修改也可以,但是URL地址会长一点。这个是文章的。 5、打开include/arc.listview.class.php 找到 $plist = str_replace(‘.php?tid=’, ‘-’, $plist); (大约在第964行) 在其前面面添加一行 $plist = str_replace(‘plus/list’, ‘list’, $plist); 这个是列表页分页rewrite的url格式的。 默认是http://www.xxx.com/plus/list-1-2-3.html 现在是http://www.xxx.com/list-1-2-3.html 6、 设置重写规则,在httpd.ini里面写上: [ISAPI_Rewrite] # 缓存3600秒 = 1 小时(hour) CacheClockRate 3600 RepeatLimit 32 #dedecms Rewrite规则 RewriteRule ^(.*)/index\.html$1/index\.php RewriteRule ^(.*)/list-([0-9]+)\.html$1/plus/list\.php\?tid=$2 RewriteRule^(.*)/list-([0-9]+)-([0-9]+)-([0-9]+)\.html$1/plus/list\.php\?tid=$2&TotalResult=$3&PageNo=$4 RewriteRule^(.*)/view-([0-9]+)-([0-9]+)\.html $1/plus/view\.php\?arcID=$2&pageno=$3 7、如果不使用动态首页 把rewrite规则中的 RewriteRule ^(.*)/index\.html $1/index\.php 去掉,或改为 RewriteRule ^(.*)/index\.html $1/index\.html 否则打开http://www.xxx.com/index.html时会陷入死循环。 说明: 1、 RewriteRule ^view-([0-9]+)-([0-9]+)\.html$/plus/view.php?aid=$1&pageno=$2 此为文章分页重写命令。 2、如果view替换成自己设置的其他词,则需要把include/arc.archives.class.php文件中的view同时替换掉。 3、重写后的URL如下: 文章页:http://www.xxx.com/view-1-1.html 列表页:http://www.xxx.com/list-1.html 如果需要改成如下格式: 文章页:http://www.xxx.com/abc/view-1-1.html 列表页:http://www.xxx.com/abc/list-1.html include/channelunit.func.php中 return $GLOBALS["cfg_plus_dir"].”/view-”.$aid.’-1.html’; 改为 return “/abc/view-”.$aid.’-1.html’; return $GLOBALS['cfg_phpurl'].”/view.php?aid=$aid”; 改为 return “/abc/view.php?aid=$aid”; $reurl = $GLOBALS['cfg_phpurl'].”/list.php?tid=”.$typeid; 改为 $reurl = “/abc/list-”.$typeid.”.html”; 重写规则改为: RewriteRule ^(.*)/index\.html $1/index\.php Rewrit手机模板dedeeRule^(.*)/abc/list-([0-9]+)\.html $1/plus/list\.php\?tid=$2 RewriteRule^(.*)/abc/list-([0-9]+)-([0-9]+)-([0-9]+)\.html$1/plus/list\.phpdede后台模板\?tid=$2&TotalResult=$3&PageNo=$4 RewriteRule^(.*)/abc/view-([0-9]+)-([0-9]+)\.html$1/plus/view\.php\?arcID=$2&pageno=$3

关键词标签: 静态 织梦 全站

声明: 本文由我的SEOUC技术文章主页发布于:2023-07-21 ,文章比较全面的dedecms织梦全站伪静态规则,织梦文章主要讲述全站,静态,织梦网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: https://www.seouc.com/article/web_33472.html

我的IDC 网站建设技术SEOUC.COM
专注网站建设,SEO优化,小程序设计制作搭建开发定制网站等,数千家网站定制开发案例,网站推广技术服务。
  • 5000+合作客服
  • 8年从业经验
  • 150+覆盖行业
  • 最新热门源码技术文章