4

我已经运行了几个测试,无法缓存 301 或 302 重定向。在我的情况下,我在页面上有大量头像图标,我希望将其重定向到 gravatar 和/或 facebook 图标,并且我希望缓存重定向,最好是在一个中等时间段内,比如一周。

示例标题:


HTTP/1.1 301 Moved Permanently
Date: Sat, 27 Nov 2010 12:13:04 GMT
Server: Apache/2.2.3 (Red Hat)
Location: http://www.gravatar.com/avatar/552e3422df95ab611ce0d8d5b5d66c67?s=50&d=identicon
Cache-Control: max-age=414000
Expires: Thu, 02 Dec 2010 07:13:04 GMT
Content-Length: 330
Content-Type: text/html; charset=iso-8859-1

这是可能的吗?如果是的话,我做错了什么?

4

1 回答 1

0

I understand you intention, but I doubt that browsers are caching 301 status responses (which is confirmed here). Reading your answer you have the HTML-content under your control. Why don't you just change the image-links inside your HTML-response? So instead working with 301 you already "migrate" the links inside the source-document and browser directly hits a 200 link.

于 2010-11-28T14:22:35.273 回答