我正在https://developers.google.com/speed/pagespeed/insights/?hl=es&url=http%3A%2F%2Fwww.legioncreativa.com%2Fwebs%2F&tab=desktop中为我的网站实现用户速度测试,
因此,此测试建议对CDN导入的文件使用“ expires”标头。
我尝试过
<FilesMatch "^(https://www.google.com/recaptcha/api.js )$">
ExpiresActive on
ExpiresDefault "access plus 1 month"
</FilesMatch>
在我的htacccess中,但是没有结果...
实际上我的.HTACCESS看起来像这样
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 10 days"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/plain "access plus 1 week"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/x-icon "access plus 3 months"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType application/x-icon "access plus 3 months"
ExpiresDefault "access plus 2 days"
</IfModule>
如何在.HTACCESS中为此URL添加过期标题。
谢谢