Zhimeng dedecms URL pseudo-static rewriting setting modification method summary

Source: Internet
Author: User
Tags php file

Linux operating system

1. First, it is best to set the topic and article to dynamic browsing so that static html files will not be generated. Dede tutorial-598080707.NET
2. Set rewrite rules. Add a. htaccess file in the system directory. The content is
Note that only the Linux operating system supports (. htaccess ). windows operating system does not support (. htaccess), so this tutorial is only available for Linux operating system space:

The code is as follows: Copy code

RewriteEngine On
RewriteRule ^ plus/list-(%0-9%%%%%.html $/plus/list. php? Tid = $1
RewriteRule ^ plus/list-(%0-9%%%%%%-(%0-9%%%%%%%%%.html $/plus/list. php? Tid = $1 & totalresult = $2 & PageNo = $3
RewriteRule ^ plus/view-(%0-9%%%-1.html $/plus/view. php? ArcID = $1
RewriteRule ^ plus/view-(%0-9%%%%%-(%0-9%%%%%%%.html $/plus/view. php? Aid = $1 & pageno = $2


If your system supports url rewriting, you can use pseudo-static access here.
3. Change the rewritten URL. Find the file/include/channelunit. func. php to open.
We can see such a statement.

The code is as follows: Copy code
Return $ GLOBALS ["pai_plus_dir"]. "/view-" .20.aid.'-1.html ';

This is the url color of the article.

The code is as follows: Copy code
$ Reurl = $ GLOBALS ['cfg _ phpurl']. "/list. php? Tid = ". $ typeid;

This is the list rewrite url.
The url can be written as: return "/view-" .20.aid.'-1.html '; and $ reurl = "/list-". $ typeid. ". html ";
At this time, the rewrite rule should also be updated.

The code is as follows: Copy code


RewriteEngine On
RewriteRule into list-(%0-9%%%%%.html $/plus/list. php? Tid = $1
RewriteRule into list-(%0-9%%%%%%-(%0-9%%%%%%%%%%.html $/plus/list. php? Tid = $1 & totalresult = $2 & PageNo = $3
RewriteRule preview view-(%0-9%%%-1.html $/plus/view. php? ArcID = $1
RewriteRule preview view-(%0-9%%%%%-(%0-9%%%%%%.html $/plus/view. php? Aid = $1 & pageno = $2

Furthermore, you can replace the view with any of your own words, which also replaces the view in the include/arc. archives. class. Php file.

Setting conditions for a Windows host:

1. The server must support URL rewriting.
2. Enable pseudo-static in the background.
3. Dynamic column settings.
4. Select dynamic browsing when adding a document.
5. Modify the php file include/channelunit. func. php.
6. Modify include/arc. listview. class. php.
7. Write rewrite rules.

Specific method:
1. Load the Rewrite module (process omitted ).
2. Select "yes" for "dedecms background-system basic parameters-core settings-" whether to use pseudo-static ".
3. Set topics and documents to dynamic browsing. It can be manual, and SQL statements are faster.
Dedecms background-SQL command line tool, execute the following statements
Set all documents to "dynamic browsing only": update dede_archives set ismake =-1
Set all columns to "use dynamic pages": update de_arctype set isdefault =-1
Changing to 1 is static. After dynamic conversion to static, HTML needs to be generated again.
By default, adding columns and articles is a dynamic and permanent method:
4. Modify the php file include/channelunit. func. php.
Search
Return $ GLOBALS ["pai_plus_dir"]. "/view-" .20.aid.'-1.html ';
Change
Return "/view-" .w.aid.'-1.html ';
Search
Return $ GLOBALS ['cfg _ phpurl']. "/view. php? Aid = $ aid ";
Change
Return "/view. php? Aid = $ aid ";
In fact, the page can not be modified, that is, the URL address will grow a little longer. This is the document page.
Search

$ Reurl = $ GLOBALS ['cfg _ phpurl']. "/list. php? Tid = ". $ typeid;


Change

The code is as follows: Copy code

$ Reurl = "/list-". $ typeid. ". html ";


This must be modified. It is the topic page.
You can do this without modifying it, but the URL address is longer. This is the article.
5. Open include/arc. listview. class. php.
Find
 

  

The code is as follows: Copy code
$ Plist = str_replace ('. php? Tid = ','-', $ plist );


(About 964th rows)
Add a line above it

The code is as follows: Copy code

$ Plist = str_replace ('plus/list', 'list', $ plist );

This is the url format of the list page rewrite.
Http://www.xxx.com/plus/list-1-2-3.html by default
It's http://www.xxx.com/list-1-2-3.html now
6. Set rewrite rules and write the following in httpd. ini:

The code is as follows: Copy code

[ISAPI_Rewrite]
# Cache 3600 seconds = 1 hour (hour)
CacheClockRate 3600
RepeatLimit 32
# Dedecms Rewrite rules
RewriteRule ^ (. *)/index.html $1/index. php
RewriteRule ^ (. *)/list-(%0-9%%%%%.html $1/plus/list. php? Tid = $2
RewriteRule ^ (. *)/list-(%0-9%%*-(%0-9%%%%%%%-(%0-9%%%%%%.html $1/plus/list. php? Tid = $2 & TotalResult = $3 & PageNo = $4
RewriteRule ^ (. *)/view-(%0-9%%*-(%0-9%%%%%%%.html $1/plus/view. php? ArcID = $2 & pageno = $3


7. If dynamic homepage is not used
In the rewrite rule
RewriteRule ^ (. *)/index.html $1/index. php
Remove or change
RewriteRule ^ (. *)/index.html $1/index.html
Otherwise, http://www.xxx.com/index.htmlwill be stuck in a loop.

Important:

A. RewriteRule preview view-(%0-9%%%%%-(%0-9%%%%%%%.html $/plus/view. php? Aid = $1 & pageno = $2
This is an article paging rewrite command.
B. If the view is replaced with other words you have set, you must replace the view in the include/arc. archives. class. Php file.
C. The rewritten URL is as follows:
Article page: http://www.xxx.com/view-1-1.html
List page: http://www.xxx.com/list-1.html
If you want to change to the following format:
Article page: http://www.xxx.com/abc/view-1-1.html
List page: http://www.xxx.com/abc/list-1.html

The code is as follows: Copy code
Include/channelunit. func. php
Return $ GLOBALS ["pai_plus_dir"]. "/view-" .20.aid.'-1.html ';
Change return "/abc/view-" .w.aid.'-1.html ';
Return $ GLOBALS ['cfg _ phpurl']. "/view. php? Aid = $ aid ";
Change to return "/abc/view. php? Aid = $ aid ";
$ Reurl = $ GLOBALS ['cfg _ phpurl']. "/list. php? Tid = ". $ typeid;
Change to $ reurl = "/abc/list-". $ typeid. ". html ";

Rewrite rules:

The code is as follows: Copy code


RewriteRule ^ (. *)/index.html $1/index. php
RewriteRule ^ (. *)/abc/list-(%0-9%%%).html $1/plus/list. php? Tid = $2
RewriteRule ^ (. *)/abc/list-(%0-9%%%}-(%0-9%%%%%%%%%%.html $1/plus/list. php? Tid = $2 & TotalResult = $3 & PageNo = $4
RewriteRule ^ (. *)/abc/view-(%0-9%%%}-(%0-9%%%%%%%.html $1/plus/view. php? ArcID = $2 & pageno = $3
 

The d、pseudo-static state can show that multiple URLs are directed to the same page. If you look at the effect of multiple URLs, you can use robots.txt to block unnecessary URLs.


Summary

Only linux hosts are supported. the htaccess file is incorrect. As long as it is apache, it can support space. how to enable htaccess. for htaccess, click enable under apache. htaccess pseudo-static support configuration method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.