如何为这些静态组件添加expires标头

时间:2018-09-28 09:55:53

标签: html .htaccess seo yslow expires-header

我正在审核我的网站的速度,ySlow表示有5个静态组件,没有过期的日期。

https://cdn.ywxi.net/js/1.js
https://fonts.googleapis.com/css? 
family=Roboto:100,100i,300,300i,400,400i,500,500i,700,700i,900,900i
https://s3-us-west-2.amazonaws.com/mfesecure- 
public/host/flatworldworks.com/client.js
https://www.mcafeesecure.com/rpc/ajax?do=tmjs- 
visit&host=flatworldworks.com&rand=1538127696761
https://cdn.ywxi.net/static/img/tm-float.png

如何将它们容纳在ftaccess文件中,该文件当前如下所示:

# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------

# These are pretty far-future expires headers.
# They assume you control versioning with filename-based cache busting
# Additionally, consider that outdated proxies may miscache
# www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/

# If you dont use filenames to version, lower the CSS and JS to something like
# access plus 1 week.

<IfModule mod_expires.c>
  ExpiresActive on

# Your document html
  ExpiresByType text/html "access plus 0 seconds"

# Media: images, video, audio
  ExpiresByType audio/ogg "access plus 1 month"
  ExpiresByType image/gif "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType video/mp4 "access plus 1 month"
  ExpiresByType video/ogg "access plus 1 month"
  ExpiresByType video/webm "access plus 1 month"

# CSS and JavaScript
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType text/css "access plus 1 year"
</IfModule>

0 个答案:

没有答案