And the application of the principle of pseudo-static

 Pseudo-static popular point that fake static pages, that is, through a variety of technical means to make dynamic URL pages and static pages look like. A typical feature is the URL of the page with a dynamic parameter, so the URL with? , And pseudo-static main purpose is to remove the URL?

          

Pseudo-static advantages

  1. Pseudo-static conducive to search engine optimization
  2. Better user experience

The difference between static and pseudo-static pages

  1. As well as the page name from the URL structure to see, pseudo-static and static pages is the same. Pseudo-static pages can be html htm suffix or directory format
  2. Pseudo-static URL just changed forms, in fact or dynamic pages
  3. Static pages can save server resources, and pseudo-static strictly speaking, it is to increase server resource consumption

Summary, in terms of SEO, functionality pseudo-static and static pages are the same, but the nature of the pseudo-static or dynamic pages, so the consumption of resources and dynamic pages is the same, but because Rewrite server also need to consume additional resources.

      The following is feeling very comprehensive Copy

Background pseudo-static technology produces:
1, static pages and dynamic comparison:
  1) static pages:
    Advantages: A, search engine friendly, is highly collection of quality; B, fast access speed; less C, resources (cpu, etc.) occupation .
    Disadvantage: A, for large portals or communities, constant changes will produce large amounts of I / O, disk fragmentation will lead to even disk bad sectors. Quite a terror risk. Once the user information is not on the game play. B, a little more storage space occupancy.
  2) dynamic web:
    Advantages: relative static, it is dynamic disadvantage of advantage - less space on the hard disk and friendly.
    Disadvantage: A, unfriendly to search engines. Search engines do not include a URL with a question mark? Because search engines due to the fear of question marks and enter an infinite loop.
B, high concurrency more resource consumption.

The pseudo-static is against this background came into being, it retains a dynamic basis of merit, so that static URL, the URL is let in without a question mark, a collection of reptiles fool on the line. Such a perfect blend of the advantages of both of the front.
Advantages: the advantages of static + dynamic advantages of
disadvantages: a slightly larger flow using pseudo-static appeared CPU usage overload, responsibility for which page is also designated by the pseudo-static is a direct result of the regular judge instead of the real address, turn-by-display resolution in the end CPU to judge, so the increase in CPU occupancy rate is indeed a pseudo-static biggest drawback.

implementation mechanism: the use of the server, for dynamic page requests to make changes, so that the browser that the visit is also static pages, this time, browse in the address bar display is a static address information (without the question mark) a.

Two methods:
1, using ISAPI_Rewrite be linked dynamically rewrite HTML static URLs. ISAPI_Rewrite is a dll component, re_write is iis inside a module. This filter is achieved by regular expressions, mapping dynamic page URLs become static URLs. As can be news.asp? Id = 95 by converting it into re_write news / 95.html. Mapping of regular expressions is set in httpd.ini file.
  For small cases of: processing the data page, it is written:
More _ <% = Page%> _ <% =% type> HTML. (Note: page is page number of pages, type is the data type) forms: More_1_95 .html
If you turn the next page, was: More_2_95.html, continue to the next cycle, it is:
More_3_95.html, and so on.
But you need to add the following code in httpd.ini file:
RewriteRule /More_(/d+)_(/d+)/.html /jsp/more/.asp/?page=$1&type=$2 [N, the I] string 9
If your program has a plurality of dynamic parameters need to be passed, then increase the number (/ d +) can be as follows:
the RewriteRule /More_(/d+)_(/d+)_(/d+)/.html / ASP / more / .asp /? page = $ 1 & type = $ 2 & type2 = $ 3 [N, I]

Pros: On the basic procedures do not need to change anything. Trouble: To achieve this iis need to be controlled, so when you hire someone else's server, you need to contact your service provider to begin with. (Of course, this is asp terms, do not ASP.NET - dll assembly directly into a bin and then program the appropriate configuration can be realized)

2, the IIS 404 error handling mechanism: custom error, steering we are ready to deal with a good page. However, this scalability to be studied, overall processing requirements of the program is high, not look for practical application.

First, set the Site Properties - Custom Italian error
to find HTTP Error 404, then edit the properties -> Message type selected URL-> URL fill "/index.asp", or your error handling page.
In this way, such as user or spider visits when http://tech.todo.net.cn/12345.html (12345 ID for the articles in the database). Because some page does not exist, it triggered a 404 error. index.asp turned
in index.asp Riga
CurrDomain = Request.ServerVariables ( "HTTP_HOST") 'current access domain
CurrURL = Replace (Request.ServerVariables ( "QUERY_STRING "), "404; http: //" & CurrDomain & ": 80", "")' current access URL
in this case CurrURL it should be:. 12345.html
this way, you get a user is trying to access the page and then extract inside the article ID. (should be: 12345), with regular, there is not much to say.
then the database to extract the contents of the article. output to the page, OK.

Conclusion: The pseudo-static too suitable for use in the general corporate website - and neither require high concurrency, but at the same time very care about seo (search engine optimization), but also requires background can be dynamically updated. - Of course, direct generate static pages also, because this community like the kind of modifier so much.

 

Guess you like

Origin www.cnblogs.com/liang-chen/p/11935460.html