DeDeBIZ的TAG标签改成ID伪静态的方法

snh102 By snh102 at 2025-01-16 • 暂不可见      举报

DedeBIZ/DedeV6: 国内流行的内容管理系统。

经过《拼音ID静态版》和《拼音伪静态版》的打磨,织梦BIZ的一套伪静态快要完成啦。

效果展示

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

TAG标签首页 http://我的网站.com/tags.html
TAG标签列表 http://我的网站.com/tags/1.html
TAG标签分页 http://我的网站.com/tags/1_2.html

注意:拼音ID静态版、拼音伪静态版,两者不能共存,包括现在的这个教程。

教程开始

1、打开 /apps/tags.php 搜索

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

在它下面加入

$tagid = intval($tag);
if(!empty($tagid))
{
	$row = $dsql->GetOne("SELECT tag FROM `#@__tagindex` WHERE id = {$tagid}");
	if(!is_array($row))
	{
		ShowMsg("系统无此标签,可能已经移除!","-1");exit();
	}
	else
	{
		$tag = $row['tag'];
	}
}
else
{
	$tag = '';
}

2、打开 /system/taglib/tag.lib.php 翻到代码最底部 看到 55起到59行

if (isset($envs['makeTag']) && $envs['makeTag'] == 1 || $ishtml == 1) {
    $row['link'] = $cfg_cmsurl.$tagsdir."/".$row['id']."/";
} else {
    $row['link'] = $cfg_cmsurl."/apps/tags.php?/".$row['id']."/";
}

改为

$row['link'] = $cfg_cmsurl."/tags/".$row['id'].".html";

3、打开 /admin/templets/tags_main.htm 找到第57行

<?php echo $cfg_phpurl;?>/tags.php?/<?php echo $fields['id'];?>/

改为

/tags/{dede:field.id/}.html

4、打开 /system/archive/taglist.class.php 搜索

该部分是隐藏区

登录后查看

该部分是隐藏区

伪静态规则

Nginx伪静态规则

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

Apache伪静态规则

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

完成了

温馨提示

内容由用户共同创建和维护,并不代表织梦爱好者论坛立场!
建议您独自对内容进行评估,核实并咨询相关的专业人士!

DeDeBIZ的TAG标签改成ID伪静态的方法DeDeBIZ的TAG标签改成ID伪静态的方法DeDeBIZ的TAG标签改成ID伪静态的方法DeDeBIZ的TAG标签改成ID伪静态的方法DeDeBIZ的TAG标签改成ID伪静态的方法+48  48 个回复 | 最后更新于 2025-01-16
该部分是隐藏区

登录后查看回复

该部分是隐藏区

登录后方可回帖

Loading...