dedecms织梦tag标签实现伪静态设置方法
dedecms织梦tag标签实现伪静态的设置方法
修改前请务必备份,以防万一
一、dede后台开启伪静态。
二、修改 /include/taglib/tag.lib.php,找到:
$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";
改成
$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword']).".html";
三、打开模板目录的taglist.htm,将 tags.php修改为tags.html
四、设置伪静态规则。
如果是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/
如果是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>
- 上一篇:中牟seo优化之网站导航规范的方法 2018/4/7
- 下一篇:中牟企业网站建设需要考虑的四个因素 2018/4/3