How long would it be useful to set the expire header for a website?

"Web pages are becoming more complex with a lot of scripts, style sheets, images and Flash. The first visit to the page may require several HTTP requests to load all components. Using Expires headers these components become cached, which avoids unnecessary HTTP requests during subsequent pageviews: Expiring headlines are most often associated with images, but they can and should be used on all page components, including scripts, style sheets, and Flash.

As written in Yslow .

My question is how long it would be useful to set the expire header for a website with multiple stylesheets, Flash headers, Javascripts, images, PDFs, MS Excel files, PPT, etc.

If I want to set the same expiration time on all things.

+5
source share
2 answers

If your page resources (images / css / js) usually do not change and are static, you can set the expires header to something far away, like 1 year .

. , , expires , .

, SO, , expires . , 60- 1 .

+2

, , CSS JavaScript , , 1 5 . JS , URL-, .

, , SO :

<link rel="stylesheet" href="http://sstatic.net/stackoverflow/all.css?v=e27c9b7474df">

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

<script src="http://sstatic.net/js/question.js?v=b05e8725a843" type="text/javascript"></script>

, , all.css?v=e27c9b7474df all.css?v=some new version. javascript question.js . , CSS/JS all-1.css, all-2.css .. , URL.

+6

All Articles