织梦电脑站手机站tag标签伪静态-单链接id版
发布时间:2021-04-30 | 发布者: | 浏览次数: 次无论你网站全站是静态或者动态还是伪静态,此教程都可以设置tag标签页为伪静态,并且是单链接id的形式
按此教程操作后,电脑站tag标签url会像如下:
- tag标签下载app送体验金26元首页 http://www.dedehtml.com/tags.html
- tag标签列表 http://www.dedehtml.com/tags/9.html
- tag标签分页 http://www.dedehtml.com/tags/9_2.html
按此教程操作后,手机站tag标签url会像如下:
- tag标签下载app送体验金26元首页 http://m.dedehtml.com/tags.html
- tag标签列表 http://m.dedehtml.com/tags/9.html
- tag标签分页 http://m.dedehtml.com/tags/9_2.html
电脑站tag伪静态实现教程
1、/tags.php 找到 18行
if(isset($tags[2])) $pageno = intval($tags[2]);
在它下面加入
$tagid = intval($tag);
if(!empty($tagid))
{
$row = $dsql->getone("select tag from `dede_tagindex` where id = {$tagid}");
if(!is_array($row))
{
showmsg("系统无此标签,可能已经移除!","-1");exit();
}
else
{
$tag = $row['tag'];
define('dederetag', 'y');
}
}
else
{
$tag = '';
}
如图
2、/include/taglib/tag.lib.php 找到 87行
$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";
改成
$row['link'] = $cfg_cmsurl."/tags/".$row['id'].".html";
3、/include/arc.taglist.class.php 找到 458行
$purl .= "?/".urlencode($this->tag);
改成
if(!defined('dederetag'))
{
$purl .= "?/".urlencode($this->tag);
}
继续找到
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 [l]
rewriterule ^tags/([0-9] )\.html$ tags\.php\?\/$1\/
rewriterule ^tags/([0-9] )_([0-9] )\.html$ tags\.php\?\/$1\/$2
rewriterule ^tags/([0-9] )_([0-9] )\.html$ tags\.php\?\/$1\/$2\/
nginx
rewrite ^/tags\.html$ /tags.php;
rewrite ^/tags/([0-9] )\.html$ /tags.php?\/$1;
rewrite ^/tags/([0-9] )\.html$ /tags.php?\/$1\/;
rewrite ^/tags/([0-9] )_([0-9] )\.html$ /tags.php?\/$1\/$2;
rewrite ^/tags/([0-9] )_([0-9] )\.html$ /tags.php?\/$1\/$2\/;
web.config (iis7 iis8)
如需后台tag标签管理里的tag链接点击打开也是伪静态可这样改
打开 /dede/templets/tags_main.htm 找到 89行
改成
手机站tag伪静态实现教程
1、m 文件夹添加tags.php文件给手机站使用
链接: https://pan.baidu.com/s/1zpg1om3e90jwoiqmiymsgw 提取码: nivw
2、手机站tag标签伪静态规则,根据自己网站的主机环境选择下面的规则
.htaccess (apache 放到m文件夹下)
rewriteengine on
rewritebase /
rewriterule ^tags\.html$ tags\.php
rewriterule ^tags/([0-9] )\.html$ tags\.php\?\/$1 [l]
rewriterule ^tags/([0-9] )\.html$ tags\.php\?\/$1\/
rewriterule ^tags/([0-9] )_([0-9] )\.html$ tags\.php\?\/$1\/$2
rewriterule ^tags/([0-9] )_([0-9] )\.html$ tags\.php\?\/$1\/$2\/
nginx
rewrite ^/tags\.html$ /tags.php;
rewrite ^/tags/([0-9] )\.html$ /tags.php?\/$1;
rewrite ^/tags/([0-9] )\.html$ /tags.php?\/$1\/;
rewrite ^/tags/([0-9] )_([0-9] )\.html$ /tags.php?\/$1\/$2;
rewrite ^/tags/([0-9] )_([0-9] )\.html$ /tags.php?\/$1\/$2\/;
web.config (iis7 iis8)
3、手机站tag标签下载app送体验金26元首页和tag标签列表页模板为
- tag_m.htm
-
taglist_m.htm
4、tag标签调用与电脑站一样
转载请标注:——
下一篇:
推荐文章
热门文章