简体   繁体   中英

How do I configure optimal cache policy for index.html page in my site?

I have a web site with an index.html homepage that is updated from time to time. We sometimes add offers for our clients, special messages and so on, which have to be visible by next day for everyone.

If index.html is cached by browsers, many users will not notice that anything has changed, unless they explicitly refresh the contents of the page...

Which is the best way to be sure that 100% visitors have an up-to-date index.html page, without compromising cache performance?

My best answer would be to skip out on updating the index.html each time and go with a server-side programming language, like PHP. You can then set the headers for the page to not cache, and you can also set up an admin page that you can use to change the content. Or you could go with a browser-side script with JavaScript using AJAX. Then the page has an ability to update before the next loading of the site.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM