Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the pseudo-static of tag tags in dedecms

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how to achieve pseudo-static tag tags in dedecms, I hope you will learn a lot after reading this article, let's discuss it together!

How does dedecms implement the pseudo-static of tag tags?

Dedecms's tag tag is a good keyword management function, through the tag tag can find the relevant keyword content. But dedecms's tag tag system defaults to / / www.xxx.net/tags.php?/tag tag / as shown in the figure below. It is not good for SEO optimization. So how do you make TAGS static? (that is, change to / / www.xxx.net/tags/1.html).

Here, pseudo-static is mainly done by modifying the label of the call.

1. Find tags.php in the dedecms program directory. Open the code that finds $PageNo=1 to exit (); (as shown below). Replace these codes with the following code:

/ / tag pseudo-static $tagid = (isset ($tagid) & & is_numeric ($tagid))? $tagid: 0 PageNo PageNo = (isset ($PageNo) & & is_numeric ($PageNo))? $PageNo: 1 if ($tagid = "0") {$dlist = new TagList ($tag, 'tag.htm'); $dlist- > Display ();} else {$row = $dsql- > GetOne ("SELECT tag FROM `tagindex` WHERE id = {$tagid}") If (! is_array ($row)) {ShowMsg ('system does not have this tag','-1'); exit ();} $tag = FilterSearch ($row ['tag']); $dlist = new TagList ($tag,' taglist.htm'); $dlist- > Display ();} exit ()

2. TAG call tag. Open the include/taglib/tag.lib.php file and find $row ['link'] = $cfg_cmsurl. "/ tags.php?/" .urlencode ($row [' keyword']). "/"; code. Replace it with $row ['link'] = "/ tags/ {$row [' id']} .html"; (note that the symbols are all in English, not Chinese. Otherwise, it cannot be found and the modification is not successful)

3. Modify the paging code. Also open include/arc.taglist.class.php and find / / get links to the previous and next pages. Replace the paging function between / / getting the previous page and the next page to / / getting the digital link with the following function:

If ($this- > page Notebook = 1) {$prepage.= "previous page\ r\ n"; $indexpage= "home page\ r\ n";} else {$indexpage= "home page\ r\ n";} if ($this- > page totalpage > 1) {$nextpage.= "next page\ r\ n"; $endpage= "last page\ r\ n";} else {$endpage= "last page\ r\ n";}

4. Set pseudo-static rules. Create a new txt text and add pseudo-static rules such as below. Then save as .htaccess and upload it to the root of the site (if you already have a pseudo-static file .htaccess, do not overwrite .htaccess. Just open it and add the following rules to save it.)

RewriteEngine onRewriteBase / RewriteRule ^ tags/ ([0-9] +) _ ([0-9] +). Html$ tags.php?tagid=$1&PageNo=$2 [L] RewriteRule ^ tags/ ([0-9] +). Html$ tags.php?tagid=$1 [L]

5. Finally, go to the dedecms background to update it, and all the settings have been completed. You can see the pseudo-static effect of http://127.0.0.1/tags/1.html as shown in the following figure.

After reading this article, I believe you have a certain understanding of how to achieve the pseudo-static of tag tags in dedecms. Want to know more about it. Welcome to follow the industry information channel. Thank you for your reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report