2017-12-22 66 views

答えて

0

Expire headersは、それがbrowser’s cacheからフェッチできるのであれば、ウェブサイト上のリソースがsourceから要求される必要があるかどうかbrowserを教えてください。

ウェブサイトに設定されているfiles/imagesは、cacheと呼ばれるものがない場合に訪問者が訪れるたびにダウンロードする必要があります。 cacheは、(コンピュータ上の)ローカルストレージにfiles/imagesをキャッシュするので、次回の訪問時には既にダウンロードした特定のfile/imageをダウンロードする必要はありません。

ウェブサイトを入力すると、ブラウザーはimage/fileがダウンロードされた日付と時刻を確認し(最後の訪問から既に取得済みの場合)、server cache settingsと比較します。キャッシュ設定は、ダウンロードしたファイルを有効なファイルとして参照する期間をブラウザに指示します。 expire headerは、expire valueからdate response headerを差し引いたfileの有効期間をブラウザに知らせる同様の設定です。 Cache-Control headermax-ageは、expire headerが設定されている場合は上書きします。あなたはすでにそれを持っているか、いない場合は、特定のfileため

max-ageた場合にかかわらず、その後、file/imageを毎回ダウンロードされます0に設定されています。

cache settingsを設定すると、returning userの操作性が向上する場合があります。あなたはfiles/imagesを変更した場合、頻繁にあなたが持っているかの一方で、日のカップルのような低い設定にmax-ageまたはexpireを設定することをお勧めします

#Example of Cache-Control headers 

# Set the settings for caching 
# max-age is in seconds 
<filesMatch ".(css|jpg|jpeg|png|gif|js|ico)$"> 
Header set Cache-Control "max-age=2628000, public" 
</filesMatch> 

# you can have as many as you want 
<filesMatch ".(css|js)$"> 
Header set Cache-Control "max-age=2628000, public" 
</filesMatch> 


# Example of Expires headers (use one or the other or both) 

<IfModule mod_expires.c > 

    # Default setting 
    ExpiresDefault       "access plus 1 month" 

    # Setting for images, video, audio 
    ExpiresByType image/gif     "access plus 1 month" 
    ExpiresByType image/png     "access plus 1 month" 
    ExpiresByType image/jpg     "access plus 1 month" 
    ExpiresByType image/jpeg    "access plus 1 month" 
    ExpiresByType video/ogg     "access plus 1 month" 
    ExpiresByType audio/ogg     "access plus 1 month" 
    ExpiresByType video/mp4     "access plus 1 month" 
    ExpiresByType video/webm    "access plus 1 month" 

    <IfModule mod_headers.c> 
     Header append Cache-Control "public" 
    </IfModule> 
</IfModule> 

:あなたの.htaccessファイルで

はこのような何かを設定しました変更しないコンテンツは、たぶん1〜2ヵ月のような設定で十分でしょう。また、お客様のニーズやウェブサイトの機能に応じて、file typeごとに特別な設定を行うこともできます。

関連する問題