The apache prompts that the max-age or expires solution is not set. max-ageexpires

Source: Internet
Author: User

The apache prompts that the max-age or expires solution is not set. max-ageexpires

You should know that you only need to Set max-age or expires. The following method is used to set apache:

Generate to enable

The Code is as follows:
LoadModule headers_module modules/mod_headers.so

Then write it under the. htaccess File

The Code is 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 the "mod_headers" module is not enabled and the "<IfModule mod_headers.c>" condition is not added, an error will occur on the website!
Setting max-age or expires is used to cache static files, improving the loading speed of websites.
From: http://www.111cn.net/sys/Windows/68259.htm


How can I set up Baidu's optimization suggestions (max-age or expires not set) when I buy a website using hichina?

This is a pseudo-static setting. Your ASP Website can produce static HTML without the need to ignore that prompt. Static data is more advantageous than pseudo static data.

How does IIS set global cache-control webpage cache or expires expiration time?

For example, if there is a similar configuration in IIS like the code of apache mod_expires header set cache-control "max-age = 3600", the configuration file is httpd because it is a virtual host. ini

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.