[Apache] mod_expires .htaccess을 수정하여 브라우저 캐싱하기
브라우저 캐싱으로 속도 가속화시키기
클라이언트에서 한번 열어본 이미지 등의 파일은 캐시 안함.
years
months
weeks
days
hours
minutes
seconds
#으로 되어있는 부분 없애고 아파치 재시작
httpd.conf LoadModule expires_module modules/mod_expires.so |
.htaccess #<IfModule mod_expires.so> ExpiresActive on
ExpiresDefault "access plus 1 month"
ExpiresByType text/cache-manifest "access plus 0 seconds" ExpiresByType text/html "access plus 0 seconds" ExpiresByType text/xml "access plus 0 seconds" ExpiresByType application/xml "access plus 0 seconds" ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/rss+xml "access plus 0 seconds" ExpiresByType application/atom+xml "access plus 0 seconds"
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 2 month" ExpiresByType audio/ogg "access plus 2 month" ExpiresByType video/mp4 "access plus 2 month" ExpiresByType video/webm "access plus 2 month"
ExpiresByType text/x-component "access plus 1 year" ExpiresByType application/x-font-ttf "access plus 1 year" ExpiresByType font/opentype "access plus 1 year" ExpiresByType application/x-font-woff "access plus 1 year" ExpiresByType image/svg+xml "access plus 1 year" ExpiresByType application/vnd.ms-fontobject "access plus 1 year" ExpiresByType text/css "access plus 1 year" ExpiresByType application/javascript "access plus 1 year" ExpiresByType image/x-icon "access plus 1 year" #</IfModule> |
## EXPIRES CACHING ## <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType image/gif "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType text/css "access plus 1 month" ExpiresByType application/pdf "access plus 1 month" ExpiresByType text/x-javascript "access plus 1 month" ExpiresByType application/x-shockwave-flash "access plus 1 month" ExpiresByType image/x-icon "access plus 1 month" ExpiresDefault "access plus 1 month" </IfModule> |