第一次编码。当我使用Gtmetrix测试我的网站时,我遇到了Add Expires Header的问题,YSlow报告我有60个Add Expires Header。
http://www.whirloo.com/wp-content/plugins/contact-form-7/includes/css/styles.css?ver=4.9.2
http://www.whirloo.com/wp-content/plugins/woocommerce/assets/css/woocommerce-layout.css?ver=3.2.6
http://www.whirloo.com/wp-content/plugins/woocommerce/assets/css/woocommerce.css?ver=3.2.6
http://www.whirloo.com/wp-content/plugins/wordpress-social-login/assets/css/style.css?ver=4.9.1
http://www.whirloo.com/wp-content/plugins/js_composer/assets/css/js_composer.min.css?ver=5.4.5
https://fonts.googleapis.com/css?family=Open+Sans:400,600%7CRoboto:400,500,400italic
http://www.whirloo.com/wp-content/plugins/google-analytics-for-wordpress/assets/js/frontend.min.js?ver=6.2.6
http://www.whirloo.com/wp-includes/js/jquery/jquery.js?ver=1.12.4
http://www.whirloo.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1
http://www.whirloo.com/wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart.min.js?ver=3.2.6
http://www.whirloo.com/wp-content/plugins/js_composer/assets/js/vendors/woocommerce-add-to-cart.js?ver=5.4.5
http://www.whirloo.com/wp-content/themes/publisher/includes/libs/better-framework/assets/css/bs-icons.css
http://www.whirloo.com/wp-content/plugins/better-social-counter/css/style.min.css
http://www.whirloo.com/wp-content/themes/publisher/includes/libs/better-framework/assets/css/slick.min.css
http://www.whirloo.com/wp-content/plugins/better-adsmanager/css/bam.min.css
我已尝试在我的.htaccess中使用其他Add Expires Header帖子中的代码,但它似乎没有解决问题。这些内容来自插件,主题,上传和字体中的内容。我该如何解决这个问题?谢谢!
在你的.htaccess上,试着用这个:
# BEGIN Expire headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 7200 seconds"
ExpiresByType image/jpg "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
AddType image/x-icon .ico
ExpiresByType image/ico "access plus 2592000 seconds"
ExpiresByType image/icon "access plus 2592000 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType text/css "access plus 2592000 seconds"
ExpiresByType text/javascript "access plus 2592000 seconds"
ExpiresByType text/html "access plus 7200 seconds"
ExpiresByType application/xhtml+xml "access plus 7200 seconds"
ExpiresByType application/javascript A2592000
ExpiresByType application/x-javascript "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
</IfModule>
# END Expire headers
不用担心这类问题的简单方法是使用Cloudflare。它将为您管理所有这些配置。