Apache hint does not set max-age or expires workaround

Source: Internet
Author: User

This should be known as long as you set the Max-age or expires on the line. Here's how to set the method under Apache:

Generate to open

Code to copy code as follows
LoadModule Headers_module modules/mod_headers.so

And then write it down Under the. htaccess file.

Code to copy code as follows
<ifmodule mod_headers.c>
<filesmatch "\. (ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf) $" >
Header set Cache-control "max-age=604800, public"
</FilesMatch>
<filesmatch (www.111cn.net) "\. (xml|txt) $" >
Header set Cache-control "max-age=18000, public, must-revalidate"
</FilesMatch>
<filesmatch "\. (html|htm|php|shtml) $" >
Header set Cache-control "max-age=3600, Must-revalidate"
</FilesMatch>
</IfModule>

If you do not open the "mod_headers" module, and do not add "<ifmodule mod_headers.c>" criteria to judge, the site will be wrong!
Setting Max-age or expires is used to cache static files, increasing the load speed of the site
From:http://www.111cn.net/sys/windows/68259.htm

Apache hint does not set max-age or expires workaround

Related Article

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.