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\/
完成了
+48 48 个回复 | 最后更新于 2025-01-16
登录后方可回帖