织梦url双斜杠 news 2.html,织梦电脑站手机站TAGS标签伪静态-单链接id版

本文提供了一套详细的教程,帮助网站管理员将TAG标签页设置为伪静态形式,包括单链接ID格式。教程覆盖了从代码修改到服务器配置的全过程,并区分了电脑版和手机版的不同配置方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

无论你网站全站是静态或者动态还是伪静态,此教程都可以设置TAG标签页为伪静态,并且是单链接id的形式

按此教程操作后,电脑站TAG标签url会像如下:

TAG标签首页 http://www.1pzy.com/tags.html

TAG标签列表 http://www.1pzy.com/tags/9.html

TAG标签分页 http://www.1pzy.com/tags/9_2.html

按此教程操作后,手机站TAG标签url会像如下:

TAG标签首页 http://m.1pzy.com/tags.html

TAG标签列表 http://m.1pzy.com/tags/9.html

TAG标签分页 http://m.1pzy.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 `qm_tagindex` WHERE id = {$tagid}");

if(!is_array($row))

{

ShowMsg("系统无此标签,可能已经移除!","-1");exit();

}

else

{

$tag = $row['tag'];

define('DEDERETAG', 'Y');

}

}

else

{

$tag = '';

}

如图

709f00b43f3c04f1bf0860e10bc3a56b.png

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链接点击打开也是伪静态可这样改

b9d5c6259477ed059c4333a53c892277.png

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

{dede:field.tag /}

改成

{dede:field.tag /}

手机站TAG伪静态实现教程

1、m 文件夹添加tags.php文件给手机站使用

链接: https://pan.baidu.com/s/1fOii42hyrzFj_zsRKe5Z_g 提取码: 22pd

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标签首页和TAG标签列表页模板为

tag_m.htm

taglist_m.htm

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值