dedecms中tags标签页伪静态化修改技巧
dedecms中tags标签页伪静态化修改技巧
dedecms中tags标签默认是php假伪静态功能就是如tags.php/xxxx/这种形式了,这种就是我说的假伪静态了,如果做到如/tag-abc/或tag/aaa.html这种呢,下面就来给大家介绍一下.
首先打开dedecms的/include/taglib/tag.lib.php文件,找到第87行如下这句代码:
$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";
将其改成如下:
$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword']).".html";
然后我们打开所使用模板文件夹下的taglist.htm文件,比如默认模板文件夹就是templets/default/taglist.htm,用编辑器打开在里面查找“tags.php”将其全部修改为“tags.html”
设置我们的伪静态规则,以IIS7为例,我们应该在web.config里写入如下伪静态规则:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="weather1" stopProcessing="true"> <match url="tags/([^-]+).html$" ignoreCase="true" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="/tags.php?/{R:1}" appendQueryString="false" /> </rule> <rule name="weather2" stopProcessing="true"> <match url="tags/([^-]+)-([0-9]+).html$" ignoreCase="true" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="/tags.php?/{R:1}/{R:2}" appendQueryString="false" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
如果你是IIS6,那么就是在httpd.ini文件里加入下面这段代码:
RewriteRule ^(.*)/tags.html $1/tags.php RewriteRule ^(.*)/tags/(.*).html $1/tags.php?$2
而Linux主机的.htaccess写法就是如下代码:
RewriteRule ^tags.html$ /tags.php RewriteRule ^tags/(.*).html$ /tags.php?/$1/
我们进入dedecms后台更新下缓存就算搞定了.
本文属原创,转载请注明原文:http://www.zhimatong.com/jiaocheng/619.html
为保证教程的实用性及扩大知识面覆盖,如果您有相似问题而未解决,可联系在线客服免费技术支持。
热门主题
相关阅读
- 织梦转XunRuiCMS时,详解5分钟完成MySQL批量处理织梦原tag数据
- 4个步骤实现dedecms织梦tag标签伪静态
- PbootCMS内链替换次数,内链一篇文章一个词如何只链接一次
- PbootCMS教程:3种常见伪静态设置方法及示例
- 织梦DedeCMS转EyouCMS使原来的html静态tag标签无缝对接,实现news_{id}_{page}.html的方法
- 织梦dedecms标签tag伪静态升级版,将URL设置为id.html附伪静态规则
- 极致CMS伪静态怎么设置,Apache/IIS/Nginx伪静态规则是什么?
- 织梦CMS调用tag时如何添加链接
- 织梦转迅睿XunRuiCMS后,自定义函数实现tag聚合页面显示不同标题颜色类似织梦页面的功能
- EyouCMS动态链接301跳转到对应伪静态地址的方法
- dedecms织梦当前文档内容自动关联tag标签做内链
- PbootCMS标签大全,PbootCMS模版如何调用tag标签