Complete weaving dream DedeCMS, set the pseudo-static process of the whole site, and reduce the amount of website files

Posted by jimiwa on Mon, 03 Jan 2022 15:51:10 +0100

Many of our webmaster friends choose the dream weaving dedecms program because they can generate HTML static files, which can reduce the load of the server to a certain extent. Therefore, we generally have more content management systems for big data. Of course, another reason is that the dedecms program is relatively simple and easy to use, and has many free theme templates.

However, Lao Jiang saw that some netizens chose the virtual host. Generally, the virtual host has a limit on the number of 25W files. If you use it to generate static files, the number of files may be limited. The only way is to set pseudo statics for the DEDECMS program, so as not to occupy the number of articles. Of course, there is no way. Generally, we won't set the big data website to pseudo static. Since this student needs to set it, I'll see how to set the pseudo static of weaving dreams.

1. Front page

The home page is simple. When setting the preview, we don't generate HTML, but directly use php to set the home page.

2. DedeCms channel, list page, article page

File found:

/include/helpers/channelunit.helper.php

The following code in GetFileName():

  //Dynamic article
  if($cfg_rewrite == 'Y')
  {
  return $GLOBALS["cfg_plus_dir"]."/view-".$aid.'-1.html';
  }

Replace with

   //Dynamic article
  if($cfg_rewrite == 'Y')
  {
  return "/archives/view-".$aid.'-1.html';
  }

The following code in GetTypeUrl():

//dynamic
$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;

Replace with

//dynamic
$reurl = "/category/list-".$typeid.".html";

3. Decms list paging

/include/arc.listview.class.php

This file opens.

Found: at the end of GetPageListDM() function

Found:

$plist = str_replace('.php?tid=', '-', $plist);

replace with

$plist = str_replace('plus', 'category', $plist);

Replace the default plus with category.

$plist = str_replace('.php?tid=', '-', $plist);

4. DedeCms article paging

Open:

/include/arc.archives.class.php

Found: end of page list GetPagebreakDM() function.

$PageList = str_replace(".php?aid=","-",$PageList);

Replace with:

$plist = str_replace('plus', 'archives', $plist);
//Replace the default plus with archives
$PageList = str_replace(".php?aid=","-",$PageList);

5. DedeCmsTAG tag

/include/taglib/tag.lib.php

Open this file. Found: lib_tag() function.

$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";

Replace with:

$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword'])."/";

6. Pseudo static file

RewriteRule ^category/list-([0-9]+).html$ /plus/list.php?tid=$1
RewriteRule ^category/list-([0-9]+)-([0-9]+)-([0-9]+).html$ /plus/list.php?tid=$1&totalresult=$2&PageNo=$3
RewriteRule ^archives/view-([0-9]+)-([0-9]+).html$ /plus/view.php?arcID=$1&pageno=$2

Here is the pseudo static file of Apache.

location / {
rewrite "^/index.html$" /index.php last;
rewrite "^/list-([0-9]+)\.html$" /plus/list.php?tid=$1 last;
rewrite "^/list-([0-9]+)-([0-9]+)-([0-9]+)\.html$" /plus/list.php?tid=$1&totalresult=$2&PageNo=$3 last;
rewrite "^/view-([0-9]+)-1\.html$" /plus/view.php?arcID=$1 last;
rewrite "^/view-([0-9]+)-([0-9]+)\.html$" /plus/view.php?aid=$1&pageno=$2 last;
rewrite "^/tags/$" /tags.php last;
rewrite "^/tags/(.*)/$" /tags.php?/$1/ last;
break;
}

This is Nginx pseudo static.

Finally, we can try, pay attention to backup first. However, I personally suggest that since you want to use DEDECMS big data, it is better to use static data.

Source: Laojiang tribe » Complete weaving dream DedeCMS, set the pseudo-static process of the whole site, and reduce the amount of website files |Welcome to share