cloudflare и аналитика gtmetrix - PullRequest
       58

cloudflare и аналитика gtmetrix

0 голосов
/ 15 декабря 2018

Эти три URL-адреса, добавленные Google Analytics и CloudFlare, делают мой сайт более низким процентным рейтингом для gtmetric, вызванным «Использовать кеширование в браузере для следующих кэшируемых ресурсов:».

enter image description here

Я добавил этот код в свой htaccess безрезультатно:

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access plus 1 year"
</IfModule>
## EXPIRES CACHING ##

<ifModule mod_headers.c>
  <filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
    Header set Cache-Control "max-age=2592000, public"
  </filesMatch>

  <filesMatch "\\.(css)$">
    Header set Cache-Control "max-age=2592000, public"
  </filesMatch>

  <filesMatch "\\.(js)$">
    Header set Cache-Control "max-age=216000, private"
  </filesMatch>

  <filesMatch "\\.(xml|txt)$">
    Header set Cache-Control "max-age=216000, public, must-revalidate"
  </filesMatch>

  <filesMatch "\\.(html|htm|php)$">
    Header set Cache-Control "max-age=1, private, must-revalidate"
  </filesMatch>
</ifModule>
...