0
我在我的网站上设置了一个子域,纯粹是为了提高网站速度(在Google推荐的多个无Cookie域中传播HTTP请求)。我一直在做实验,看起来我的.htaccess缓存设置在子域上没有相同的效果。.htaccess跨子域缓存问题
比较这两个URL,且他们的反应/缓存时间:
http://www.scenepointblank.com/assets/img/features/coming_in_2012_homepage.png(原件) http://img.scenepointblank.com/features/coming_in_2012_homepage.png(子域)
看着它似乎已经拿起相同cache_control
响应报头,但实际响应时间变化相当大(我看到www
的平均值为〜400ms,img
的值为〜4s)。
我的.htaccess文件位于域的根目录下,为了实验,我还在scenepointblank.com/assets/img/
中添加了一个副本,但没有任何效果。该文件的内容如下:
FileETag MTime Size
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
<FilesMatch .php$>
# Do not allow PHP scripts to be cached unless they explicitly send cache
# headers themselves. Otherwise all scripts would have to overwrite the
# headers set by mod_expires if they want another caching behavior.
ExpiresActive Off
</FilesMatch>
</IfModule>
# 480 weeks
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=290304000, public"
</FilesMatch>
任何想法,为什么会发生这种情况?
只注意到的子域的一个返回HTTP 200,但在WWW上的一个返回304想这是有关... – 2012-03-14 22:52:22