What are the best solutions for static and pseudo-static priority problems?

Source: Internet
Author: User
Tags apache php
What are the best solutions to solve static and pseudo-static priority problems? What are the best solutions to solve static and pseudo-static priority problems? System: & nbsp; Linux & nbsp; Apache & nbsp; PHP/5.2.17 is now used on the server. what are the best solutions for static and pseudo-static priority problems when using htaccess to rewrite the address?
What are the best solutions to solve static and pseudo-static priority problems?

System: Linux Apache PHP/5.2.17

Now the server uses. htaccess to rewrite the address for pseudo-static and cache. However, it often exceeds the cpu limit of the space provider, which has been forced to shut down twice recently.

Now, I want to change most pages to pure static, and only the pages still retain pseudo static.
Now we want to directly link to the "pure static html" page if the "pure static html" page exists. if the "pure static html" page does not exist, we will use pseudo static.

However, we know that the "pure static" page cannot be accessed under the standard with pseudo-static rules and will always be linked to the corresponding php page for execution.

When querying Baidu, we can see that different suffixes are used to distinguish between pure static and pseudo static, such as. htm. html.

This can be achieved, but it is very troublesome to modify the .html in many templates. could you please tell me if there is a better solution.

Hope you will not be enlightened!

Thank you! Share static pseudo-static priorities:
------ Solution --------------------
In any case, you must use the PHP program to determine whether a static page exists. In short, apache does not care about this.

If (! File_exists ('XXX/xx.htm ')
------ Solution --------------------
(Time ()-filemtime ('XXX/xx.htm')> 3600 )){
// Code generation automatic program, saved as xxx/xx.htm
} Else {
// File_get_contents (xxx/xx.htm );
}

Let's move on to the source code to reduce include, require, and reasonably use unset (); merge the same code for function () calls, and so on.

In addition, you can consider changing the space.
------ Solution --------------------
1. if there is no suffix, it is obviously not true or static. It also needs to be modified.
What's more, the url of the pseudo-static page should be generated by the function. if you do not do this, you should resolutely correct it.
2. common rewrite rules include
RewriteCond % {REQUEST_FILENAME }! -F
If the file exists, access the file directly without the following RewriteRule.
3. if php processing is required for all existing. htm instances, I don't know what your "static" means.

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.