How to configure pseudo-static throughout the entire DreamWeaver system?
Detailed explanation of the pseudo-static configuration process of the whole site of Dreamweaver System
The premise is to ensure that your space or server supports pseudo-static, that is, URL rewriting; the method to enable pseudo-static: background-- 》System--》Core settings found: Whether to use pseudo-static: Select Yes to confirm the save. For specific configuration, please see this article
Recommended learning:梦Weavercms
Kai Pseudo Static prerequisites
Ensure that your space or server supports pseudo-static, that is, URL rewriting
Turn on DedeCms pseudo-static
How to turn on pseudo-static :Backend--"System--"Core Settings Find: Whether to use pseudo-static: Select Yes to save.
Column and article publishing settings
Column list options: Choose to use dynamic page publishing options: Choose only dynamic browsing
DEDECMS full-site pseudo-static method
Pseudo-static homepage
Delete the index.html in the root directory of the site and do not update the homepage HTML in the future. Of course, you can also choose not to use a dynamic homepage.
Channel, list, article pseudo-static
Mainly achieved by modifying the two functions GetFileName() and GetTypeUrl(). For DedeCms V5.3, DedeCms V5.5 and DedeCms V5.6 versions, open /include/channelunit.func.php for modification.
Note: DedeCms V5.7, the path of this file has changed, you can open /include/helpers/channelunit.helper.php.
a. Replace the following code in GetFileName(): //Dynamic article
The code is as follows:
if($cfg_rewrite == 'Y') { return $GLOBALS["cfg_plus_dir"]."/view-".$aid.'-1.html'; }
Replace with //Dynamic article
code As follows:
if($cfg_rewrite == 'Y') { return "/archives/view-".$aid.'-1.html'; }
Change the default /plus/view-1-1.html
link format of the article page to /archives/view-1-1.html
This is up to personal preference, and it doesn’t matter if you don’t make any changes.
b. Replace the following code in GetTypeUrl(): //Dynamic
The code is as follows:
$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
Replace with //Dynamic
The code is as follows:
$reurl = "/category/list-".$typeid.".html";
This step must be modified, that is, change the URL of your channel or list page to the form /category/list-1.html.
Pseudo-static list paging
Open /include/arc.listview.class.php and find the end of the GetPageListDM() function to get the dynamic paging list:
The code is as follows:
$plist = str_replace('.php?tid=', '-', $plist);
is replaced with
The code is as follows:
$plist = str_replace('plus', 'category', $plist);
Replace the default plus with
The code is as follows:
category$plist = str_replace('.php?tid=', '-', $plist);
Page the list The default link format /plus/list-1-2-1.html
is changed to /category/list-1-2-1.html
This step can also be left unchanged.
DEDECMS article paging pseudo-static
Open /include/arc.archives.class.php and find the end of the GetPagebreakDM() function to get the dynamic paging list:
The code is as follows :
$PageList = str_replace(".php?aid=","-",$PageList);
Replace with
The code is as follows:
$plist = str_replace('plus', 'archives', $plist);
Replace the default plus with
The code is as follows:
archives$PageList = str_replace(".php?aid=","-",$PageList);
This step It's fine without modification, it's just a matter of personal preference.
TAG tag pseudo-static
The default TAG tag URL of DedeCms is in the shape of /tags.php?/dedecms5.7/, which is very ugly. Open /include/taglib/tag.lib.php and find under the lib_tag() function:
The code is as follows:
$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";
Replace with
The code is as follows:
$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword'])."/";
At this point, the ".php?" number in the TAG tag URL has been removed.
Search pseudo-static
DedeCms search URL staticization is more troublesome, not to mention the many parameters attached, and the parameters may also change. URLs such as search results pagination are particularly troublesome, and pseudo-static rule matching is complicated. Xiaopin was lazy and directly replaced "search.php?..." in the search URL with "search.html?...". As for the parameters after the "?" symbol, they were matched with any characters.
Open channelunit.func.php, arc.searchview.class.php, arc.taglist.class.php and /include/taglib/hotwords.lib.php in the include folder in sequence, and search for "search. php?" can be replaced with "search.html?".
Tips, I personally feel that dedecms itself does not intend to allow users to set pseudo-static functions, so I feel that it is still very complicated for ordinary people to modify it.
The above is the detailed content of How to configure the pseudo-static of the entire site of the DreamWeaver system. For more information, please follow other related articles on the PHP Chinese website!