2017-03-29 7 views
-2

내 WordPress 사이트에 대한 Google 및 GTmetrix 속도 테스트에 비참하게 실패합니다. 둘 모두 브라우저 캐싱이 사용 가능하지 않도록 지정합니다.Pages 속도 문제 : 브라우저 캐싱을 활용합니다

WP 수퍼 캐시와 같은 몇 가지 캐싱 플러그인을 시도했지만 효과가 없습니다.

##### EXPIRE CACHING - LEVERAGE BROWSER CACHING ##### 
<IfModule mod_expires.c> 
ExpiresActive On 
ExpiresDefault "access plus 1 month 1 days" 
ExpiresByType text/html "access plus 1 month 1 days" 
ExpiresByType image/gif "access plus 1 month 1 days" 
ExpiresByType image/jpeg "access plus 1 month 1 days" 
ExpiresByType image/png "access plus 1 month 1 days" 
ExpiresByType text/css "access plus 1 month 1 days" 
ExpiresByType text/javascript "access plus 1 month 1 week" 
ExpiresByType application/x-javascript "access plus 1 month 1 days" 
ExpiresByType text/xml "access plus 1 seconds" 
</IfModule> 
##### END EXPIRE CACHING ##### 

그러나 다시, 그것은했다 제로에 미치는 영향 :

또한 수동으로 다음과 htaccess로 파일을 편집했습니다. 나는 호스트 제공자 인 BlueHost를 세 번이나 시도해 봤지만 매번 다른 응답을주었습니다. 그러나 그들은 모두 "우리와 관련이 없습니다."와 거의 같습니다.

내가 잘못 생각한 사람이 있습니까?

나는 벽돌 벽에 머리를 대고있는 것처럼 느껴진다.

저에게 도움을 주시면 감사하겠습니다.

답변

0

추가 한 코드는 mod_expires 모듈이 활성화 된 경우에만 작동합니다.

또는이 단지 내부 파일, 외부 파일을 제어 할 수 없습니다 브라우저 캐싱을 활용하는 것, (을 .htaccess에 추가)

# 1 YEAR 
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$"> 
Header set Cache-Control "max-age=31536000, public" 
</FilesMatch> 
# 1 WEEK 
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$"> 
Header set Cache-Control "max-age=604800, public" 
</FilesMatch> 
# 1 WEEK 
<FilesMatch "\.(txt|xml|js|css)$"> 
Header set Cache-Control "max-age=604800" 
</FilesMatch> 
# NEVER CACHE - notice the extra directives 
<FilesMatch "\.(html|htm|php|cgi|pl)$"> 
Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate" 
</FilesMatch> 

유의하시기 바랍니다 다음 코드를 사용할 수 있습니다.

+0

외부 파일의 경우 'cron': [타사 JS 용 레버리지 브라우저 캐싱] (http://stackoverflow.com/questions/38376871/leverage-browser-caching-for-3rd-party-js)을 사용할 수 있습니다./38377857 # 38377857) – Lag

+0

도움 주셔서 감사합니다. 나는 당신이 준 코드를 시도했는데 그 코드는 작동하지 않는 것 같습니다. – Sarah

1

WP Super Cache (이 스레드를 찾은 방법)와 동일한 문제가있었습니다. WP Fastest Cache로 전환했는데 (옵션에서 토글 설정으로 사용) - 아직 해결하지 못했을 경우에 대비해 게시 할 것입니다.