欢迎来到素材无忧网,按 + 收藏我们
登录 注册 退出 找回密码

织梦电脑站手机站TAG标签伪静态-单链接名称版

时间: 2020-09-15 15:33 阅读: 作者:素材无忧网

电脑站TAG伪静态实现教程

1、/tags.php 找到 18行

if(isset($tags[2])) $PageNo = intval($tags[2]);

在它下面加入

define('DEDERETAG', 'Y');

2、/include/taglib/tag.lib.php 找到 87行

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

改成

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

3、/include/arc.taglist.class.php 找到 458行

$purl .= "?/".urlencode($this->Tag);

改成

if(!defined('DEDERETAG'))
{
    $purl .= "?/".urlencode($this->Tag);
}
else
{
	$purl = $GLOBALS['cfg_cmsurl']."/tags/".urlencode($this->Tag).".html";
}

继续找到

return $plist;

在它上面加入

if(defined('DEDERETAG'))
{
	$plist = preg_replace('/_(\d+).html/i','.html',$plist);
	$plist = preg_replace('/.html\/(\d+)\//i','_\\1.html',$plist);
}

4、电脑站TAG标签伪静态规则,根据自己网站的主机环境选择下面的规则

.htaccess (Apache)

RewriteEngine On
RewriteBase /
RewriteRule ^tags\.html$	tags\.php
RewriteRule ^tags/(.*)_([0-9]+)\.html$	tags\.php\?\/$1\/$2
RewriteRule ^tags/(.*)_([0-9]+)\.html$	tags\.php\?\/$1\/$2\/
RewriteRule ^tags/(.*)\.html$	tags\.php\?\/$1 [L]
RewriteRule ^tags/(.*)\.html$	tags\.php\?\/$1\/

Nginx

rewrite "^/tags\.html$"	/tags.php;
rewrite "^/tags/(.*)_([0-9]+)\.html$"	/tags.php?/$1/$2/ last;
rewrite "^/tags/(.*)\.html$"	/tags.php?/$1/;

web.config (iis7 iis8)

<rule name="tag首页">
	<match url="^tags.html$" ignoreCase="false" />
	<action type="Rewrite" url="tags.php" appendQueryString="false" />
</rule>
<rule name="tag列表分页">
	<match url="^tags/(.*)_([0-9]+).html$" ignoreCase="false" />
	<action type="Rewrite" url="/tags.php?/{R:1}/{R:2}" appendQueryString="false" />
</rule>
<rule name="tag列表分页最后有左斜杠">
	<match url="^tags/(.*)_([0-9]+).html$" ignoreCase="false" />
	<action type="Rewrite" url="/tags.php?/{R:1}/{R:2}/" appendQueryString="false" />
</rule>
<rule name="tag列表">
	<match url="^tags/(.*).html$" ignoreCase="false" />
	<action type="Rewrite" url="/tags.php?/{R:1}" appendQueryString="false" />
</rule>
<rule name="tag列表最后有左斜杠">
	<match url="^tags/(.*).html$" ignoreCase="false" />
	<action type="Rewrite" url="/tags.php?/{R:1}/" appendQueryString="false" />
</rule>

打开 /dede/templets/tags_main.htm 找到 89行

<a href="../tags.php?/<?php echo urlencode($fields['tag']); ?>/" target="_blank">{dede:field.tag /}</a>

改成

<a href="../tags/<?php echo urlencode($fields['tag']); ?>.html" target="_blank">{dede:field.tag /}</a>

手机站TAG伪静态实现教程

1、m 文件夹添加tags.php文件给手机站使用(点击下方下载)

 下载此插件

2、手机站TAG标签伪静态规则,根据自己网站的主机环境选择下面的规则

.htaccess (Apache 放到m文件夹下)

RewriteEngine On
RewriteBase /
RewriteRule ^tags\.html$	tags\.php
RewriteRule ^tags/(.*)_([0-9]+)\.html$	tags\.php\?\/$1\/$2
RewriteRule ^tags/(.*)_([0-9]+)\.html$	tags\.php\?\/$1\/$2\/
RewriteRule ^tags/(.*)\.html$	tags\.php\?\/$1 [L]
RewriteRule ^tags/(.*)\.html$	tags\.php\?\/$1\/

Nginx

rewrite "^/tags\.html$"	/tags.php;
rewrite "^/tags/(.*)_([0-9]+)\.html$"	/tags.php?/$1/$2/ last;
rewrite "^/tags/(.*)\.html$"	/tags.php?/$1/;

web.config (iis7 iis8)

<rule name="tag首页">
	<match url="^tags.html$" ignoreCase="false" />
	<action type="Rewrite" url="tags.php" appendQueryString="false" />
</rule>
<rule name="tag列表分页">
	<match url="^tags/(.*)_([0-9]+).html$" ignoreCase="false" />
	<action type="Rewrite" url="/tags.php?/{R:1}/{R:2}" appendQueryString="false" />
</rule>
<rule name="tag列表分页最后有左斜杠">
	<match url="^tags/(.*)_([0-9]+).html$" ignoreCase="false" />
	<action type="Rewrite" url="/tags.php?/{R:1}/{R:2}/" appendQueryString="false" />
</rule>
<rule name="tag列表">
	<match url="^tags/(.*).html$" ignoreCase="false" />
	<action type="Rewrite" url="/tags.php?/{R:1}" appendQueryString="false" />
</rule>
<rule name="tag列表最后有左斜杠">
	<match url="^tags/(.*).html$" ignoreCase="false" />
	<action type="Rewrite" url="/tags.php?/{R:1}/" appendQueryString="false" />
</rule>

 

3、手机站TAG标签首页和TAG标签列表页模板为

tag_m.htm

taglist_m.htm

4、TAG标签调用与电脑站一样

版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!

转载请注明: 织梦电脑站手机站TAG标签伪静态-单链接名称版

模板推荐