52
Add Expires headers
There are 21 static components without a far-future expiration date.

    http://static.doers.lk/examples-offline.css
    http://static.doers.lk/kendo.common.min.css
    http://static.doers.lk/kendo.default.min.css
    http://static.doers.lk/style.css
    http://static.doers.lk/jquery.min.js
    http://static.doers.lk/kendo.web.min.js
    http://static.doers.lk/console.js
    http://static.doers.lk/sprite.png
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    https://fbexternal-a.akamaihd.net/safe_image.php?...
    http://static.doers.lk/favicon.PNG

yahoo YSLOW を使用してサイトをテストすると、上記のメッセージが表示されます。したがって、期限切れヘッダーを追加する方法がわかりません。何か助けていただければ幸いです。

4

5 に答える 5

73

これらのヘッダーを追加する最も簡単な方法は.htaccess、サーバーに構成を追加するファイルです。管理していないサーバーでアセットがホストされている場合、それに対してできることは何もありません。

一部のホスティング プロバイダーではファイルの使用が許可されないことに注意してください.htaccess。機能しない場合は、その条件を確認してください。

HTML5Boilerplate プロジェクトには.htaccess、必要な設定をカバーする優れたファイルがあります。Github リポジトリでファイルの関連部分を参照してください

これらは重要なビットです

# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------

# These are pretty far-future expires headers.
# They assume you control versioning with filename-based cache busting
# Additionally, consider that outdated proxies may miscache
# www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/

# If you don't use filenames to version, lower the CSS and JS to something like
# "access plus 1 week".

<IfModule mod_expires.c>
  ExpiresActive on

# Your document html
  ExpiresByType text/html "access plus 0 seconds"

# Media: images, video, audio
  ExpiresByType audio/ogg "access plus 1 month"
  ExpiresByType image/gif "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType video/mp4 "access plus 1 month"
  ExpiresByType video/ogg "access plus 1 month"
  ExpiresByType video/webm "access plus 1 month"

# CSS and JavaScript
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType text/css "access plus 1 year"
</IfModule>

彼らはそのファイルが何をするかを文書化しました. 最も重要なビットは、CSS と Javascript ファイルが変更されるたびに名前を変更する必要があるということです.

于 2012-12-20T12:54:04.727 に答える
3

それらを htaccess ファイルまたは vhost 構成に追加できます。

ここを参照してください: http://httpd.apache.org/docs/2.2/mod/mod_expires.html

しかし、あなたがそれらのドメインを所有していない限り.. それらはあなたの管理下にあります。

于 2012-12-20T12:53:40.200 に答える