當(dāng)前位置:首頁(yè) >  站長(zhǎng) >  編程技術(shù) >  正文

織夢(mèng)dedecms tag設(shè)置id.html教程

 2021-01-27 16:51  來(lái)源: 白天博客   我來(lái)投稿 撤稿糾錯(cuò)

  域名預(yù)訂/競(jìng)價(jià),好“米”不錯(cuò)過(guò)

1、在網(wǎng)站根目錄下的tags.php中18行找到:

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("系統(tǒng)無(wú)此標(biāo)簽,可能已經(jīng)移除!","-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);

}

繼續(xù)找到:

return $plist;

在其上方加入代碼:

if(defined('DEDERETAG'))

{

$plist = preg_replace('/_(\d+).html/i','.html',$plist);

$plist = preg_replace('/.html\/(\d+)\//i','_\\1.html',$plist);

$plist = str_replace('_1','',$plist);

}

4、tag 標(biāo)簽偽靜態(tài)規(guī)則,請(qǐng)根據(jù)自己所使用的服務(wù)器環(huán)境選擇對(duì)應(yīng)的規(guī)則.

.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)

5、后臺(tái)TAG標(biāo)簽管理里的TAG鏈接修改為偽靜態(tài)(非必需,根據(jù)需要修改)

在/dede/templets/tags_main.htm文件89行找到:

{dede:field.tag /}

將其替換為:

{dede:field.tag /}

注:以上默認(rèn)為PC站tag標(biāo)簽偽靜態(tài),將tag標(biāo)簽的URL鏈接修改id.html的方法,如果你的網(wǎng)站有移動(dòng)端且使用的是動(dòng)態(tài)頁(yè)面,那么你還需將移動(dòng)端tag標(biāo)簽的鏈接偽靜態(tài),獨(dú)立移動(dòng)端方法一樣修改對(duì)應(yīng)文件即可。

文章來(lái)源:白天博客

來(lái)源地址:https://www.seobti.com/2776.html

申請(qǐng)創(chuàng)業(yè)報(bào)道,分享創(chuàng)業(yè)好點(diǎn)子。點(diǎn)擊此處,共同探討創(chuàng)業(yè)新機(jī)遇!

相關(guān)文章

熱門排行

信息推薦