{"id":895,"date":"2017-04-26T12:35:36","date_gmt":"2017-04-26T04:35:36","guid":{"rendered":"https:\/\/www.ipcpu.com\/?p=895"},"modified":"2017-04-26T12:35:36","modified_gmt":"2017-04-26T04:35:36","slug":"http-301-cache","status":"publish","type":"post","link":"https:\/\/c.ipcpu.com\/2017\/04\/http-301-cache\/","title":{"rendered":"HTTP301\u91cd\u5b9a\u5411\u5728\u6d4f\u89c8\u5668\u4e2d\u80fd\u7f13\u5b58\u591a\u957f\u65f6\u95f4"},"content":{"rendered":"

HTTP301\u91cd\u5b9a\u5411\u5728\u6d4f\u89c8\u5668\u4e2d\u80fd\u7f13\u5b58\u591a\u957f\u65f6\u95f4.md<\/p>\n

<\/p>\n

\u5c0fA\u7684\u60e8\u75db\u7ecf\u5386<\/h2>\n

\u8fd0\u7ef4\u5c0fA\u5728\u67d0\u6b21\u7ef4\u62a4\u8fc7\u7a0b\u4e2d\uff0c\u5c06\u7f51\u7ad9 http:\/\/example1.com\/<\/a> \u7684\u8bf7\u6c42301\u91cd\u5b9a\u5411\u5230\u4e86 http:\/\/example2.com\/<\/a> \u3002<\/p>\n

\u81ea\u5df1\u7528\u6d4f\u89c8\u5668\u8bd5\u4e86\u4e00\u4e0b\uff0c\u679c\u7136\u90fd\u8df3\u8f6c\u5230 http:\/\/example2.com\/<\/a> \u4e86\u3002<\/p>\n

\u7ef4\u62a4\u5b8c\u6210\u540e\uff0c\u6062\u590d\u914d\u7f6e\uff0c\u4f46\u53d1\u73b0\u81ea\u5df1\u7684Chrome\u6d4f\u89c8\u5668\u8fd8\u662f\u76f4\u63a5\u8df3\u8f6c\u5230\u4e86 http:\/\/example2.com\/<\/a> \u3002<\/p>\n

\u91cd\u542fchrome\uff0c\u4e0d\u884c\u3002\u6e05\u9664\u7f13\u5b58\uff0c\u8fd8\u4e0d\u884c\u3002\u6293\u72c2\u4e86\u3002<\/p>\n

\u76f4\u5230\u627e\u5230\u4e86\u8fd9\u4e48\u4e00\u4e2a\u7b54\u6848\uff1a<\/p>\n

Go to chrome:\/\/net-internals and at the far right open the drop-down and choose \"Clear Cache\". <\/p>\n

\u7ec8\u4e8e\u8df3\u56de\u6765\u4e86\u3002<\/p>\n

\u5404\u4e2a\u6d4f\u89c8\u5668\u4f1a\u7f13\u5b58\u591a\u957f\u65f6\u95f4<\/h2>\n

\u8fd9\u662f\u4e00\u4e2a\u6781\u4e3a\u590d\u6742\u7684\u95ee\u9898\uff0c\u6839\u636e\u7f51\u53cb\u53cd\u9988\u6c47\u603b
\nIE7, IE8 \u4e0d\u4f1a\u7f13\u5b58301
\nIE 11 \u4f1a\u7f13\u5b58301\uff0c\u65f6\u95f4\u672a\u77e5\uff0c\u91cd\u542f\u65e0\u6548
\nChrome \u4f1a\u7f13\u5b58301\uff0c\u65f6\u95f4\u672a\u77e5\uff0c\u91cd\u542f\u65e0\u6548
\nFirefox \u4f1a\u7f13\u5b58301\uff0c\u65f6\u95f4\u672a\u77e5\uff0c\u91cd\u542f\u65e0\u6548<\/p>\n

\u4f7f\u7528301\u65f6\u7684\u5efa\u8bae<\/h2>\n

\u867d\u7136\u90e8\u5206\u6d4f\u89c8\u5668\u6e05\u7406\u7f13\u5b58\u80fd\u53bb\u9664301\u7f13\u5b58\uff0c\u4f46\u603b\u4e0d\u80fd\u8981\u6c42\u7528\u6237\u53bb\u6e05\u7406\u6d4f\u89c8\u5668\u7f13\u5b58\u5427\uff1f<\/p>\n

\u56e0\u6b64\u4f7f\u7528HTTP301\u91cd\u5b9a\u5411\u65f6\u8981\u683c\u5916\u6ce8\u610f\uff0c\u4ee5\u4e0b\u4e24\u79cd\u65b9\u5f0f\u53ef\u4ee5\u907f\u514d\u8e29\u5751\u3002<\/p>\n

1.\u4f7f\u7528302\u8df3\u8f6c\u66ff\u4ee3301\u8df3\u8f6c<\/strong><\/p>\n

301\u662f\u6c38\u4e45\u91cd\u5b9a\u5411\uff0c\u4e0d\u9002\u5408\u4e34\u65f6\u8df3\u8f6c\uff0c302\u624d\u662f\u4e34\u65f6\u8df3\u8f6c<\/p>\n

\n
#@nginx\u914d\u7f6e\nlocation \/ {\n        rewrite ^ https:\/\/www.baidu.com redirect;\n}<\/code><\/pre>\n<\/div>\n

2.\u7ed9301\u8df3\u8f6c\u52a0\u4e0ano-cache<\/strong><\/p>\n

\n
#@nginx\u914d\u7f6e\nlocation \/ {\n        add_header Cache-Control no-cache;\n        rewrite ^ https:\/\/www.baidu.com permanent;\n}<\/code><\/pre>\n<\/div>\n

\u53c2\u8003\u8d44\u6599<\/h2>\n

http:\/\/stackoverflow.com\/questions\/9130422\/how-long-do-browsers-cache-http-301s<\/a><\/p>\n

<\/p>\n

<\/div>\n
<\/div>\n
\n
<\/div>\n
<\/div>\n
<\/div>\n
<\/div>\n
<\/div>\n<\/div>\n
\n
<\/div>\n
<\/div>\n
<\/div>\n
<\/div>\n
<\/div>\n<\/div>\n

<\/wiz_tmp_tag><\/p>\n

\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1aIPCPU-\u7f51\u7edc\u4e4b\u8def<\/a> » HTTP301\u91cd\u5b9a\u5411\u5728\u6d4f\u89c8\u5668\u4e2d\u80fd\u7f13\u5b58\u591a\u957f\u65f6\u95f4<\/a><\/p>","protected":false},"excerpt":{"rendered":"

HTTP301\u91cd\u5b9a\u5411\u5728\u6d4f\u89c8\u5668\u4e2d\u80fd\u7f13\u5b58\u591a\u957f\u65f6\u95f4.md \u5c0fA\u7684\u60e8\u75db\u7ecf\u5386 \u8fd0\u7ef4\u5c0fA\u5728\u67d0\u6b21\u7ef4\u62a4\u8fc7\u7a0b\u4e2d\uff0c\u5c06\u7f51\u7ad9 http:\/\/example1.com\/ \u7684\u8bf7\u6c42301\u91cd\u5b9a\u5411\u5230\u4e86 http:\/\/example2.com\/ \u3002 \u81ea\u5df1\u7528\u6d4f\u89c8\u5668\u8bd5\u4e86\u4e00\u4e0b\uff0c\u679c\u7136\u90fd\u8df3\u8f6c\u5230 http:\/\/example2.com\/ \u4e86\u3002 \u7ef4\u62a4\u5b8c\u6210\u540e\uff0c\u6062\u590d\u914d\u7f6e\uff0c\u4f46\u53d1\u73b0\u81ea\u5df1\u7684Chrome\u6d4f\u89c8\u5668\u8fd8\u662f\u76f4\u63a5\u8df3\u8f6c\u5230\u4e86 http:\/\/example2.com\/ \u3002 \u91cd\u542fchrome\uff0c\u4e0d\u884c\u3002\u6e05\u9664\u7f13\u5b58\uff0c\u8fd8\u4e0d\u884c\u3002\u6293\u72c2\u4e86\u3002 \u76f4\u5230\u627e\u5230\u4e86\u8fd9\u4e48\u4e00\u4e2a\u7b54\u6848\uff1a Go to chrome:\/\/net-internals and at the far right open the drop-down and choose “Clear Cache”. \u7ec8\u4e8e\u8df3\u56de\u6765\u4e86\u3002 \u5404\u4e2a\u6d4f\u89c8\u5668\u4f1a\u7f13\u5b58\u591a\u957f\u65f6\u95f4 \u8fd9\u662f\u4e00\u4e2a\u6781\u4e3a\u590d\u6742\u7684\u95ee\u9898\uff0c\u6839\u636e\u7f51\u53cb\u53cd\u9988\u6c47\u603b IE7, IE8 \u4e0d\u4f1a\u7f13\u5b58301 IE 11 \u4f1a\u7f13\u5b58301\uff0c\u65f6\u95f4\u672a\u77e5\uff0c\u91cd\u542f\u65e0\u6548 Chrome \u4f1a\u7f13\u5b58301\uff0c\u65f6\u95f4\u672a\u77e5\uff0c\u91cd\u542f\u65e0\u6548 Firefox \u4f1a\u7f13\u5b58301\uff0c\u65f6\u95f4\u672a\u77e5\uff0c\u91cd\u542f\u65e0\u6548 \u4f7f\u7528301\u65f6\u7684\u5efa\u8bae \u867d\u7136\u90e8\u5206\u6d4f\u89c8\u5668\u6e05\u7406\u7f13\u5b58\u80fd\u53bb\u9664301\u7f13\u5b58\uff0c\u4f46\u603b\u4e0d\u80fd\u8981\u6c42\u7528\u6237\u53bb\u6e05\u7406\u6d4f\u89c8\u5668\u7f13\u5b58\u5427\uff1f \u56e0\u6b64\u4f7f\u7528HTTP301\u91cd\u5b9a\u5411\u65f6\u8981\u683c\u5916\u6ce8\u610f\uff0c\u4ee5\u4e0b\u4e24\u79cd\u65b9\u5f0f\u53ef\u4ee5\u907f\u514d\u8e29\u5751\u3002 1.\u4f7f\u7528302\u8df3\u8f6c\u66ff\u4ee3301\u8df3\u8f6c 301\u662f\u6c38\u4e45\u91cd\u5b9a\u5411\uff0c\u4e0d\u9002\u5408\u4e34\u65f6\u8df3\u8f6c\uff0c302\u624d\u662f\u4e34\u65f6\u8df3\u8f6c #@nginx\u914d\u7f6e location \/ { rewrite ^ https:\/\/www.baidu.com […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,13],"tags":[95,14],"_links":{"self":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/895"}],"collection":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/comments?post=895"}],"version-history":[{"count":0,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/895\/revisions"}],"wp:attachment":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/media?parent=895"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/categories?post=895"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/tags?post=895"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}