标题 | dedecms实现文章栏目和文章页面伪静态方法 |
内容 | 一、首先必须保证你的空间或服务器支持伪静态即url重写。 二、网站后台开启伪静态。 开启伪静态的方法:后台--》系统--》核心设置,找到:是否使用伪静态,选择是,确定保存。 三、网站增加栏目设置使用动态页。 栏目列表选项: 选择使用动态页 四、添加文章时选择使用动态浏览。 发布选项: 选择 仅动态浏览 return /view.php?aid=$aid; 五、dedecms5.7以上版本得改include/helpers/channelunit.helper.php dedecms其他版本需要修改php文件include/channelunit.func.php 1.修改栏目页: 查找 function gettypeurl $reurl = $globals['cfg_phpurl']./list.php?tid=.$typeid; 修改为: $reurl = /list-.$typeid..html; 2.文章详细页修改 1)查找 function getfilename 里面的 return $globals[cfg_plus_dir]./view-.$aid.'-1.html'; 修改为: return /view-.$aid.'-1.html'; 2)查找 return $globals['cfg_phpurl']./view.php?aid=$aid; 修改为: return /view.php?aid=$aid; 其实不修改也可以,但是url地址会长一点,根据自己的需要而设定吧。 六、需要在根目录下增加一个.htaccess文件。 添加如下代码: options +followsymlinks directoryindex index.html rewriteengine on rewritebase / rewritecond %{the_request} ^[a-z]{3,9} /index.(php|html|htm) http/ rewriterule ^index.(php|html|htm)$ http://www.dede.com/ [r=301,l] #伪静态文章列表list,文章详细页view rewriterule ^list-([0-9]+).html$ /plus/list.php?tid=$1 rewriterule ^list-([0-9]+)-([0-9]+)-([0-9]+).html$ /plus/list.php?tid=$1&totalresult=$2&pageno=$3 rewriterule ^view-([0-9]+)-1.html$ /plus/view.php?arcid=$1 rewritecond %{the_request} ^[a-z]{3,9} /index.(php|html|htm) http/ rewriterule ^index.(php|html|htm)$ http://www.dede.com/ [r=301,l] 这段代码实现首页301跳转和把index.html跳转到www域名上,把dede.com改成你的域名即可,如果不需要的话直接删掉这两句。简单的使用下面的代码: rewriteengine on #伪静态文章列表list,文章详细页view rewriterule ^list-([0-9]+).html$ /plus/list.php?tid=$1 rewriterule ^list-([0-9]+)-([0-9]+)-([0-9]+).html$ /plus/list.php?tid=$1&totalresult=$2&pageno=$3 rewriterule ^view-([0-9]+)-1.html$ /plus/view.php?arcid=$1 以上就完成了dedecms的伪静态方法,其实也简单! |
随便看 |
|
在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。