首页 » 建站技术 » WordPress » 浏览内容
使用.htaccess缓存代码 给wordpress提速
以下代码能大大提高网站的访问速度,
在网站的根目录新建 .htaccess 文件,粘贴如下代码:
# 1 YEAR <FilesMatch "\.(ico|pdf|flv){1}quot;> Header set Cache-Control "max-age=29030400, public" </FilesMatch> # 1 WEEK <FilesMatch "\.(jpg|jpeg|png|gif|swf){1}quot;> Header set Cache-Control "max-age=604800, public" </FilesMatch> # 2 DAYS <FilesMatch "\.(xml|txt|css|js){1}quot;> Header set Cache-Control "max-age=172800, proxy-revalidate" </FilesMatch> # 1 MIN <FilesMatch "\.(html|htm|php){1}quot;> Header set Cache-Control "max-age=60, private, proxy-revalidate" </FilesMatch>