• <tfoot id='SBbIF'></tfoot>

      <bdo id='SBbIF'></bdo><ul id='SBbIF'></ul>

    <legend id='SBbIF'><style id='SBbIF'><dir id='SBbIF'><q id='SBbIF'></q></dir></style></legend>
    <i id='SBbIF'><tr id='SBbIF'><dt id='SBbIF'><q id='SBbIF'><span id='SBbIF'><b id='SBbIF'><form id='SBbIF'><ins id='SBbIF'></ins><ul id='SBbIF'></ul><sub id='SBbIF'></sub></form><legend id='SBbIF'></legend><bdo id='SBbIF'><pre id='SBbIF'><center id='SBbIF'></center></pre></bdo></b><th id='SBbIF'></th></span></q></dt></tr></i><div id='SBbIF'><tfoot id='SBbIF'></tfoot><dl id='SBbIF'><fieldset id='SBbIF'></fieldset></dl></div>

        <small id='SBbIF'></small><noframes id='SBbIF'>

      1. 在 HTTP 标头中设置到期日期或最长期限

        时间:2024-08-23

          <small id='wqpd6'></small><noframes id='wqpd6'>

          • <i id='wqpd6'><tr id='wqpd6'><dt id='wqpd6'><q id='wqpd6'><span id='wqpd6'><b id='wqpd6'><form id='wqpd6'><ins id='wqpd6'></ins><ul id='wqpd6'></ul><sub id='wqpd6'></sub></form><legend id='wqpd6'></legend><bdo id='wqpd6'><pre id='wqpd6'><center id='wqpd6'></center></pre></bdo></b><th id='wqpd6'></th></span></q></dt></tr></i><div id='wqpd6'><tfoot id='wqpd6'></tfoot><dl id='wqpd6'><fieldset id='wqpd6'></fieldset></dl></div>
            <tfoot id='wqpd6'></tfoot>

              • <bdo id='wqpd6'></bdo><ul id='wqpd6'></ul>
                  <tbody id='wqpd6'></tbody>
                <legend id='wqpd6'><style id='wqpd6'><dir id='wqpd6'><q id='wqpd6'></q></dir></style></legend>
                  本文介绍了在 HTTP 标头中设置到期日期或最长期限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我刚刚完成了一个我指定的网站并将其提交给 Google 洞察

                  剪切和粘贴的示例

                  <IfModule mod_headers.c># 星期<FilesMatch ".(jpg|jpeg|png|gif|swf)$">标头集 Cache-Control "max-age=604800, public"</文件匹配></IfModule>

                  如果从 PHP 外壳交付材料,您可以使用 PHP 创建标头,在这种情况下,您可以参考此处概述的 HTTP 协议第 14.9 节缓存控制 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

                  我认为 .htaccess 在这两种方法中更容易.

                  I just finished a website that I designated and submitted it to google insights http://developers.google.com/speed/pagespeed/insights/ for performance reviews, and this is the result I got.

                  It says, I need to set expiry date or a maximum age in the the HTTP headers, but I don't know how it is possible to set expiry date for anything other than cookies/sessions.

                  解决方案

                  Generally that is done using the .htaccess file on your host. Here is an example cut and pasted from HTTP cache headers with .htaccess

                  <IfModule mod_headers.c>
                  # WEEK
                  <FilesMatch ".(jpg|jpeg|png|gif|swf)$">
                      Header set Cache-Control "max-age=604800, public"
                  </FilesMatch>
                  </IfModule>
                  

                  If delivering materials from a PHP shell you could use PHP to create the header in which case you would refer to the HTTP protocal outlined here section 14.9 Cache-Control http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

                  <?php
                  /* This file is a wrapper, */
                  
                  header( 'Cache-Control: max-age=604800' );
                  /* now get and send images */
                  ?>
                  

                  I consider the .htaccess the easier of the two methods.

                  这篇关于在 HTTP 标头中设置到期日期或最长期限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                1. <tfoot id='zH0Ap'></tfoot>

                        <bdo id='zH0Ap'></bdo><ul id='zH0Ap'></ul>
                            <tbody id='zH0Ap'></tbody>
                          <i id='zH0Ap'><tr id='zH0Ap'><dt id='zH0Ap'><q id='zH0Ap'><span id='zH0Ap'><b id='zH0Ap'><form id='zH0Ap'><ins id='zH0Ap'></ins><ul id='zH0Ap'></ul><sub id='zH0Ap'></sub></form><legend id='zH0Ap'></legend><bdo id='zH0Ap'><pre id='zH0Ap'><center id='zH0Ap'></center></pre></bdo></b><th id='zH0Ap'></th></span></q></dt></tr></i><div id='zH0Ap'><tfoot id='zH0Ap'></tfoot><dl id='zH0Ap'><fieldset id='zH0Ap'></fieldset></dl></div>

                          <small id='zH0Ap'></small><noframes id='zH0Ap'>

                          <legend id='zH0Ap'><style id='zH0Ap'><dir id='zH0Ap'><q id='zH0Ap'></q></dir></style></legend>