开发者

Browser cache behaviour for redirects

I'm trying to开发者_如何学Python figure out if redirecting all www.example.com requests to example.com will be beneficial for caching or not, to which end I have 2 questions. SEO is not an issue here.

  1. If the browser requests an image from the www URL (#1) and gets HTTP redirected to the www-less version (#2), will it store the result as cache value for just #2, or #1 as well.

  2. The browser will occasionally ask for a new version of the image (and might get it, or a "Not Modified" response). There will then be an overhead for having to process the redirect every time. Is this overhead larger than the cost of storing two versions of the same image?


  1. If the browser requests an image from the www URL (#1) and gets HTTP redirected to the www-less version (#2), will it store the result as cache value for just #2, or #1 as well.
    @: See W3C Status Code Definitions for 301. If it's a 301 redirect, it 'should' be cacheable. See How to Redirect a Web Page (301).

  2. The browser will occasionally ask for a new version of the image (and might get it, or a "Not Modified" response). There will then be an overhead for having to process the redirect every time. Is this overhead larger than the cost of storing two versions of the same image?
    @: I'm not exactly sure of this, I suppose if the redirect is handled by the webserver (IIS, apache etc), the overhead should be minimal. Don't quote me though :P

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜