2017-12-22 9 views

답변

0

Expire headers는이 browser’s cache로부터 꺼낼 수있는 경우 웹 사이트에 자원이 source에서 요청해야 또는 여부를 browser을 말한다.

웹 사이트에서 설정 한 files/imagescache이없는 경우 방문자가 방문 할 때마다 다운로드해야합니다. cache은 컴퓨터의 로컬 저장소에 files/images을 캐시하므로 다음 번에 방문 할 때 이미 다운로드 한 특정 file/image을 다운로드 할 필요가 없습니다.

웹 사이트를 입력하면 브라우저에서 image/file이 다운로드 된 날짜와 시간을 확인하고 (최근 방문에서 이미 확인한 경우) server cache settings과 비교합니다. 캐시 설정은 브라우저에 다운로드 한 파일을 유효한 파일로 참조하는 기간을 알려줍니다. expire headerexpire value에서 date response header을 뺀 file의 유효 기간을 브라우저에 알려주는 비슷한 설정입니다. 에있는 max-ageexpire 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 파일에서

는 다음과 같이 설정 변경되지 않는 콘텐츠는 한두 달 정도의 설정으로 충분할 수 있습니다. 필요에 따라 웹 사이트가 작동하는 방식에 따라 file type에 대한 특별 설정을 지정할 수도 있습니다.

관련 문제