브라우저가 웹 글꼴을 오랫동안 캐시하고 빠른 다운로드를 위해 gzip을 시도하도록 설정하려고합니다..htaccess를 통해 헤더 만료 및 gzipping 데이터 설정하기
나는 당신이 httpd.conf
파일 (아파치 또는 .htaccess
)을 통해 이것을 할 수 있다고 생각합니다.
그래도 gzip을 사용할 수 있는지 알 수 없지만 httpd.conf
파일을 DEFLATE
으로 검색하는 방법에 대해 읽었습니다. 나는 그것을했다. 그러나 아무것도 발견하지 않았다 - 그것이 가능하게되는지 아닌지 명확히하지 않는다!?
어쨌든이 코드는 .htaccess
파일에 넣었습니다. 부분적으로는 httpd.conf 파일에 넣을 위치를 알지 못했기 때문에 부분적으로는 내 호스트를 괴롭히지 않고 .htaccess 파일을 변경하기가 쉽기 때문입니다 계속. 여기
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
을 볼 때 내가 궁금하네요, 이제 ..
# Add correct content-type for fonts
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType font/x-woff .woff
AddType image/svg+xml .svg
# Compress compressible fonts
AddOutputFilterByType DEFLATE font/ttf font/otf image/svg+xml
# Add a far future Expires header for fonts
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType font/ttf "access plus 1 year"
ExpiresByType font/otf "access plus 1 year"
ExpiresByType font/x-woff "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
코드입니다
.htaccess
파일에 저장하는 위치가 중요합니까, 아니면 어디에서든지 갈 수 있습니까?
http://httpd.apache.org/docs/2.2/mod/mod_expires.html#expiresbytype
컨텍스트 : 각 지시어 항목의 상단에있는 아파치 문서 개요 상자에서와 같이
또한 AddOutputFilterByType이 htaccess에서 허용되므로 해당 부분이 ok이어야합니다. 다음은 gzipping 글꼴을 다루는 또 다른 질문입니다. http://stackoverflow.com/questions/9506347/how-to-gzip-font-face-example – WebChemist
정보를 제공해 주셔서 감사합니다. 글꼴이 만료 될 때 내가 게시 한 두 가지 버전 중 어느 버전이 올바른지 알고 싶습니다. 또한 .htaccess에 코드를 넣을 수 있습니까? 마치 mod rewrites보다 높거나 낮 으면 상관 없습니다. – Brett
추가 정보 편집보기 – WebChemist