Home >Backend Development >PHP Tutorial >Recommended video tutorial materials for php to achieve page staticization
As we all know, page staticization is an essential skill in the development of portal websites. "Video Tutorial on Implementing Page Staticization in PHP" analyzes it from two perspectives: pure staticization and pseudo-staticization, and leads everyone to master how to achieve page staticization in PHP. Generate purely static pages and how to configure pseudo-static in the WEB server to help everyone master another salary increase tool.
Course playback address: http://www.php.cn/course/403.html
The teacher’s teaching style:
The teacher’s lectures are vivid, witty, witty, and touching. A vivid metaphor is like the finishing touch, opening the door to wisdom for students; an appropriate humor brings a knowing smile to students, like drinking a glass of mellow wine, giving people aftertaste and nostalgia; a philosopher's aphorisms, cultural references Proverbs are interspersed from time to time in the narration, giving people thinking and warning.
The more difficult point in this video is PHP's processing of pseudo-static:
First of all, what is pseudo-static:
Pseudo-static, also known as URL rewriting, is a dynamic URL that looks like a static URL. In other words, dynamic web pages remove the parameters of dynamic web pages by rewriting the URL method, but there is no need to implement rewritten pages in the actual web page directory.
In addition, two noun parsing are being added
Static URL: Pure static HTML document, web page that can be queried using filetype:htm
Dynamic URL: The content is stored in the database , display the content according to the requirements, the URL starts with? # & Display different parameters, such as: news.php? lang=cn&class=1&id=2
The pros and cons between dynamic, static and pseudo-static (new)
Dynamic URL
First of all, dynamic URL is currently not suitable for Google The statement "cannot be crawled" is wrong. Google can handle dynamic URLs very well and crawl them smoothly. Secondly, the statement "cannot have more than 3 parameters" is also incorrect. Google can crawl dynamic URLs with more than 3 parameters. Dynamic URLs, however, should minimize parameters in order to avoid the URL being too long.
Secondly, dynamic URLs have certain advantages. As mentioned above, news.php? lang=cn&class=1&id=2 For example, the parameters in the URL accurately tell Google that the content language of this URL is cn, it belongs to category 1, and the content ID is 2, which makes it easier for Google to identify and process the content.
Finally, dynamic URLs should be as concise as possible, especially the session identifier (sid) and query (query) parameters, which can easily lead to a large number of identical pages.
Static URL
First of all, the absolute advantage of static URL is its clarity. /product/nokia/n95.html and /about.html can be easily understood and thus appear in the search results. Maybe the number of clicks is relatively high.
Secondly, static URLs may not be the best URL form. As mentioned above, dynamic URLs can tell Google some identifiable parameters, while static URLs will not be properly arranged if the document layout is not appropriate (such as too flat). , placing all HTML documents in the root directory) and other factors, it is not as rich in reference information as static URLs provide Google.
Finally, does Le Sishu think there is any hidden meaning in Google’s article? "Updating pages with this type of URL can be time-consuming, especially when the amount of information grows quickly, because the compilation code must be changed for each individual page." Although it is a website, is it the same in the Google system? Does such a problem exist?
Pseudo-static URL
First of all, pseudo-static URLs cannot make dynamic URLs "static". Pseudo-static URLs are just a rewrite of dynamic URLs. Google will not consider pseudo-static URLs to be HTML documents. .
Secondly, pseudo-static is desirable, but the focus should be on removing redundant parameters, standardizing URLs, and avoiding duplicate pages as much as possible.
Finally, pseudo-static has great potential dangers. It is best to use it when you are familiar with the website system, website structure, content distribution, and parameter meaning.
When writing pseudo-static rules, you should retain valuable parameters and do not streamline all valuable parameters, such as news.php in the previous example? lang=cn&class=1&id=2 is better rewritten as news-cn-class1-id2.html rather than overly concise and rewritten as news-2.html.
Furthermore, the pseudo-static must not contain session ID (sid) and query (query) parameters, /product.asp? For a dynamic URL like sid=98971298178906&id=1234, the sid in it is originally recognized and blocked by Google. However, if it is rewritten as /product/98971298178906/1234, Google will not only be unable to recognize it, but will also cause unlimited duplicate pages in the entire site (each session A new session ID will be generated).
Should we choose pseudo-static or true static
1. There is no difference between using true static and false static for SEO
2. Use True static may cause hard disk damage and affect forum performance
3. Using pseudo-static will occupy a certain amount of CPU occupancy, and heavy use will cause CPU overload
4. The most important thing One thing, we need to be static for SEO
So:
1. Using the true static method can be directly eliminated, because no matter how it is generated, it will be very harmful to the hard disk.
2. Since the effects of true and false static are the same, we can choose pseudo-static.
3. However, extensive use of pseudo-static will cause CPU overload.
4. So as long as we don’t use it in large quantities, it’s fine.
5. Since static is only for SEO, we only need pseudo-static for SEO, and there is no need for users to use it.
6. So we only need to use pseudo-static in the Archiver specially provided for SEO crawling.
7. Thank you all for your patience in reading my article.
8. If you have any questions or different opinions, you are welcome to comment
on pseudo-static and true static.
There are still true static and pseudo-static Essential difference. Processing a pure HTML for browsing users and a PHP that calls multiple data have significantly less CPU usage than the former. I remember someone once said that the hard disk is frequently read and written when downloading HTML. He said this as if reading the database does not require reading and writing to the disk. What's more, there are a lot of cached scattered PHP that are also placed on the hard disk. Doesn't these reads require disk operations? ridiculous.
The purpose can be achieved by reading a single html + image Flash and other attachments. Why bother reading the database, reading the PHP cache file, re-integrating the data output, and then adding image Flash and other attachments? The CMS homepage does not require a lot of interaction, and the forum version should not be used here. On the contrary, what should be considered more is: beauty! compatible! Intuitive information! performance! And stability!
The above is the detailed content of Recommended video tutorial materials for php to achieve page staticization. For more information, please follow other related articles on the PHP Chinese website!