wp为文件增加过期时间

Posted on Posted in wordpress
Tips: 本文创建于2014年8月26日,已超过 2 年,内容或图片可能已经失效!

为文件添加过期时间
只需要在网站的.htaccess文件中加入以下代码

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A600
ExpiresByType image/x-icon A2592000
ExpiresByType application/x-javascript A604800
ExpiresByType text/css A604800
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType text/plain A86400
ExpiresByType application/x-shockwave-flash A2592000
ExpiresByType video/x-flv A2592000
ExpiresByType application/pdf A2592000
ExpiresByType text/html A600
</IfModule>

或者

# 减少 HTTP headers 的大小
FileETag none
# Expire images header
# A2592000 为 1 个月 (60*60*24*30=2592000)
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
» 转载请注明来源:呢喃 » wp为文件增加过期时间