DEDECMS V5.7 伪静态设置

分类:建站教程 时间:2024-12-22 19:02 浏览:0 评论:0
0

DEDE虽然可以生成静态页面, 也可以重写成为伪静态. 在后台有设置可以开启伪静态. 开启后还要经过一定的设置才能使用.

  1. 首先栏目和文章最好设置成动态浏览. 这样才不会生成静态html文件.

  2. 设置重写规则. 在系统目录下加一个 .htaccess文件.

内容为:


RewriteEngine On
RewriteRule ^plus/list-([0-9]+)\.html$ /plus/list.php?tid=$1
RewriteRule ^plus/list-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /plus/list.php?tid=$1&totalresult=$2&PageNo=$3
RewriteRule ^plus/view-([0-9]+)-1\.html$ /plus/view.php?arcID=$1
RewriteRule ^plus/view-([0-9]+)-([0-9]+)\.html$ /plus/view.php?aid=$1&pageno=$2


如果你的系统支持url重写,到这里就可以用伪静态访问了.

3.更改重写的URL.

如果用默认的设置, 访问的URL是:

http://www.XXXX.com/plus/view-131-1.html

这样的形色, 我们是可以更改这种样式的.

找到文件/include/helpers/channelunit.helper.php打开.

可以看到有这样的语句

return $GLOBALS["cfg_plus_dir"]."/view-".$aid.'-1.html';

这就是文章的url形色.

$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;

这是列表的重写url.

可以使url更短一点,完成可以写成:

return "/view-".$aid.'-1.html';

$reurl = "/list-".$typeid.".html";

这时重写规则也要更新.

RewriteEngine On
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
RewriteRule ^view-([0-9]+)-([0-9]+)\.html$ /plus/view.php?aid=$1&pageno=$2

更进一步,还可以把view换成自己的任何词语,这也要把include/arc.archives.class.php文件中的view也一样替换。

发布选项: 生成HTML 仅动态浏览 发文章的时候选一下也不多事。为了以后升级 尽量减少修改文件。

以下这没有试,大家按需要测试吧~~

修改数据库

将所有文档设置为“仅动态”,可以进入数据库管理中,执行下面命令:

update dede_archives set ismake=-1

并将ismake的默认值设置为 -1即动态。

将所有栏目设置为“使用动态页”,可以进入数据库管理中,执行下面命令:

update dede_arctype set isdefault=-1



1. 本站所有资源来源于用户上传或网络,仅作为参考研究使用,如有侵权请邮件联系站长!
2. 本站积分货币获取途径以及用途的解读,想在本站混的好,请务必认真阅读!
3. 本站强烈打击盗版/破解等有损他人权益和违法作为,请各位会员支持正版!
4. 建站教程 > DEDECMS V5.7 伪静态设置

用户评论

function fuckyou() { window.close(); window.location = "about:blank"; } function ck() { console.profile(); console.profileEnd(); if (console.clear) { console.clear() }; if (typeof console.profiles == "object") { return console.profiles.length > 0; } } function hehe() { if ((window.console && (console.firebug || console.table && /firebug/i.test(console.table()))) || ( typeof opera == 'object' && typeof opera.postError == 'function' && console.profile.length > 0)) { fuckyou(); } if (typeof console.profiles == "object" && console.profiles.length > 0) { fuckyou(); } } hehe(); window.onresize = function() { if ((window.outerHeight - window.innerHeight) > 200) fuckyou(); }