Introduction to pseudo static technology and analysis of advantages and disadvantages (more complete)

Source: Internet
Author: User
Tags servervariables

1. Static web pages and dynamic comparison:
1) Static webpage:
Advantages: A. It is friendly to search engines and has high indexing quality. B. It has fast access speed. C. It uses less resources (CPU, etc.
Disadvantage: A. For large portals, or Community Continuous modification will produce a large amount of I/O, which may cause disk fragments or even bad sectors. It is a terrible hidden danger. Once the user information is gone, there will be no play. B. More storage space is occupied.
2) dynamic webpage:
Advantage: Compared with static storage, the advantage of dynamic storage is that it occupies less space and is hard disk friendly.
Disadvantage: A. It is unfriendly to search engines. Will search engines not include websites with question marks? Because the search engine is afraid of entering an endless loop due to question marks. See another note in detail (learning note-basic knowledge of Web Search)
B. High concurrency consumes a large amount of resources.

In this context, pseudo-static data emerged. It makes the website static based on the dynamic advantages, that is, without question marks in the website, you just need to cheat the included crawlers. This perfectly combines the advantages of both sides.
Advantages: static advantages + dynamic advantages
Insufficient: the CPU usage is overloaded when the traffic is slightly larger and the pseudo-static traffic is used. Because the pseudo-static traffic is determined by regular expressions rather than the real address, the responsibility for determining which page is displayed is determined by the CPU directly. Therefore, the increase in CPU usage is indeed the biggest drawback of pseudo-static.

Implementation Mechanism: it is to use the server side to make changes to the requested dynamic page, so that the browser can think that the accessed static page is also, at this time, static address information (without question marks) is displayed in the address bar of the browser.

Two implementation methods:
1. Use isapi_rewrite for Dynamic Link rewriting of HTML static URL. Isapi_rewrite is a DLL component, and re_write is a module in IIS. This filter maps Dynamic Web URLs to static Web URLs through regular expressions. If news. asp? Id = 95 convert it to news/95.html through re_write. The ing regular expression is set in the httpd. ini file.
For example, to process data paging, the statement is as follows:
More _ <% = Page % >_< % = type %>. html (Note: page is the page turning page and type is the data type) Format: more_rj95.html
If the next page is turned over, it is: more_2_95.html. To continue the next page loop, it is:
More_3_95.html, and so on.
However, you need to add the following to the httpd. ini file:Code:
Rewriterule/more _ (\ D +) \. html/JSP/more \. asp \? Page = $1 & type = $2 [N, I] string 9
If your dynamicProgramIf multiple parameters need to be passed, add multiple (\ D +) as follows:
Rewriterule/more _ (\ D +) \. html/asp/more \. asp \? Page = $1 & type = $2 & type2 = $3 [N, I]

Advantage: No changes are required in the program. Trouble: To achieve this, you need to control IIS. Therefore, when you rent someone else's server, you need to contact the service provider first. (Of course, this is for ASP, Asp.net does not need to -- directly put the DLL assembly into the bin of the program and then implement the appropriate configuration)

2. IIS 404 error handling mechanism: Turn to the prepared processing page through custom errors. However, this scalability remains to be studied, and the overall requirements for program processing are also high, which is not suitable for practical applications.

First, set site properties-custom errors
Locate HTTP Error 404, edit properties, select the URL for the message type, and enter "/index. asp" in the URL, or enter your error handling page.
This way, for example, when a user or a spider accesses a http://tech.todo.net.cn/12345.html (12345 isArticleIn the database ID). Because some pages do not exist, the 404 error is triggered and the index. asp
Add in index. asp
Currdomain = request. servervariables ("http_host") 'current access domain name
Currurl = Replace (request. servervariables ("QUERY_STRING"), "404; http: //" & currdomain & ": 80", "") 'current access URL
The currurl should be 12345.html.
In this way, we can get the page that the user is trying to access. Then we can extract the Article ID (which should be: 12345) and use regular expressions. I will not talk about it here.
Then extract the article content from the database and output it to the page. Then, it will be OK.

Conclusion: pseudo-static data is suitable for common enterprise websites. It requires no high concurrency, but also SEO (Search Engine Optimization) and dynamic updates in the background. -- Of course, it is fine to directly generate static pages, because this is not as large as the modification volume in the community.

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.