Home> CMS Tutorial> DEDECMS> body text

How dedecms makes pseudo-static pages

Release: 2019-07-16 17:12:45
Original
3274 people have browsed it

How dedecms makes pseudo-static pages

第一步、后台-系统参数-核心设置-是否使用伪静态:选择“是”;

注:你的网站空间是否支持伪静态,你可以与空间的IDC商联系一下,如果是自己的服务器,那就更好办了,自己动手,丰衣足食。一般来说,空间都是支持伪静态的。Apache服务器伪静态相对简单,直接在.htaccess文件中加入相应伪静态规则即可;而IIS服务器伪静态的实现,则需要加载Rewrite组件,然后配置httpd.ini文件。

第二步、如果你的网站已经存在生成的静态栏目或文章HTML,那么只需在后台-系统-SQL命令行工具中执行如下语句:

将所有文档设置为“仅动态浏览”:

update dede_archives set ismake=-1
Copy after login

将所有栏目设置为“使用动态页”:

update dede_arctype set isdefault=-1
Copy after login

第三步、列表页、文章页伪静态修改

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

(1)查找:

if($cfg_rewrite == 'Y')   {   return $GLOBALS["cfg_plus_dir"]."/view-".$aid.'-1.html';   }
Copy after login

替换为

if($cfg_rewrite == 'Y')   {   return "/DedeCMS/DedeCMS5.7-".$aid.'-1.html';   }
Copy after login

意思是:将默认的/plus/view-1-1.html文章链接格式改为/DedeCMS/DedeCMS5.7-1-1.html。

(2) 查找:

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

替换为:

意思是:将默认的频道或是列表页URL/plus//list.php?tid=1变更为/dedecms/list-1.html形式。

第四步、列表分页伪静态修改

打开/include/arc.listview.class.php

查找:

$plist = str_replace('.php?tid=', '-', $plist);
Copy after login

替换为

$plist = str_replace('plus/list.php?tid=', ‘DedeCMS/DedeCMS5.7-', $plist);
Copy after login

将默认的plus/list.php?tid=替换成RMB/list-;

意思是:将默认的列表分页链接格式plus/list.php?tid=x$x$xl修改为DedeCMS/DedeCMS5.7-x-x-x.html。

第五步、文章分页伪静态

打开/include/arc.archives.class.php,找到获取动态的分页列表GetPagebreakDM()函数末尾处:

查找:

$PageList = str_replace("plus/view.php?tid=","DedeCMS/DedeCMS5.7-",$PageList);
Copy after login

替换为

$plist = str_replace('plus/view.php?tid=', ’DedeCMS/DedeCMS5.7-', $plist);
Copy after login

将默认的plus/view.php?tid=替换成RMB/huilv-;

意思是:将默认的文章分页链接格式plus/view.php?tid=x$x$xl修改为DedeCMS/DedeCMS5.7-x-x-x.html

第六步、TAG标签伪静态

DedeCms默认的TAG标签URL,形如/tags.php?/dedecms模板 /,是不是觉得有个问号不怎么爽,我们改成/tags/dedecms模板 /,是不是好看多了。

下面我们来改一下,打开/include/taglib/tag.lib.php:

查找:

$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";
Copy after login

替换为

$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword'])."/";
Copy after login

这样就修改好了,上传你到你的网站,切记:要记得将原网站备份哦!!

第七步、httpd.ini伪静态规则:

[ISAPI_Rewrite]   # 3600 = 1 hour   CacheClockRate 3600   RepeatLimit 32   RewriteRule ^(.*)/RMB/list-([0-9]+)\.html $1/plus/list\.php\?tid=$2 [I]   RewriteRule ^(.*)/RMB/list-([0-9]+)-([0-9]+)-([0-9]+)\.html $1/plus/list\.php\?tid=$2&TotalResult=$3&PageNo=$4 [I]   RewriteRule ^(.*)/RMB/huilv-([0-9]+)-([0-9]+)\.html $1/plus/view\.php\?arcID=$2&pageno=$3 [I]   RewriteRule ^(.*)/(.*)_(.*)_([0-9]+)\.html $1/huilv/?from=$2&to=$3&num=$4 [I]   RewriteRule ^(.*)/tags\.html $1/tags\.php [I]   RewriteRule ^(.*)/tags/(.*)(?:(\?.*))* $1/tags\.php\?\/$2 [I]   RewriteRule ^(.*)/tags/(.*)\/(?:(\?.*))* $1/tags\.php\?\/$2\/ [I]   RewriteRule ^(.*)/tags/(.*)\/([0-9])(?:(\?.*))* $1/tags\.php\?\/$2\/$3 [I]   RewriteRule ^(.*)/tags/(.*)\/([0-9])\/(?:(\?.*))* $1/tags\.php\?\/$2\/$3\/ [I]
Copy after login

将上面代码保存为:httpd.ini上传到网站的根目录。

如无特殊需求建议采用官方默认的生成静态的页面方式浏览。

更多DedeCMS相关技术文章,请访问DedeCMS教程栏目进行学习!

The above is the detailed content of How dedecms makes pseudo-static pages. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!