{"id":75,"date":"2008-03-18T23:58:08","date_gmt":"2008-03-18T15:58:08","guid":{"rendered":"http:\/\/www.cnmiss.cn\/?p=74"},"modified":"2010-12-02T06:31:27","modified_gmt":"2010-12-02T06:31:27","slug":"301%e8%bd%ac%e5%90%91","status":"publish","type":"post","link":"https:\/\/www.cnmiss.cn\/?p=75","title":{"rendered":"301\u8f6c\u5411"},"content":{"rendered":"<p>301\u8f6c\u5411(\u6216\u53eb301\u91cd\u5b9a\u5411\uff0c301\u8df3\u8f6c)\u662f\u5f53\u7528\u6237\u6216\u641c\u7d22\u5f15\u64ce\u5411\u7f51\u7ad9\u670d\u52a1\u5668\u53d1\u51fa\u6d4f\u89c8\u8bf7\u6c42\u65f6\uff0c\u670d\u52a1\u5668\u8fd4\u56de\u7684HTTP\u6570\u636e\u6d41\u4e2d\u5934\u4fe1\u606f(header)\u4e2d\u7684\u72b6\u6001\u7801\u7684\u4e00\u79cd\uff0c\u8868\u793a\u672c\u7f51\u9875\u6c38\u4e45\u6027\u8f6c\u79fb\u5230\u53e6\u4e00\u4e2a\u5730\u5740\u3002<\/p>\n<p>\u5176\u5b83\u5e38\u89c1\u7684\u72b6\u6001\u7801\u8fd8\u5305\u62ec\uff0c200\u8868\u793a\u4e00\u5207\u6b63\u5e38\uff0c404\u7f51\u9875\u627e\u4e0d\u5230\uff0c302\u6682\u65f6\u8f6c\u5411\uff0c\u7b49\u7b49\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u8981\u505a\u7f51\u5740\u8f6c\u5411\uff1f<\/p>\n<p>\u9664\u4e86\u524d\u9762\u4ecb\u7ecd\u8fc7\u7684\u7f51\u5740\u89c4\u8303\u5316\u95ee\u9898\u5916\uff0c\u8fd8\u6709\u5f88\u591a\u9700\u8981\u505a\u7f51\u5740\u8f6c\u5411\u7684\u60c5\u5f62\u3002\u6bd4\u5982\uff0c\u4e3a\u4fdd\u62a4\u7248\u6743\uff0c\u4f60\u62e5\u6709\u4e0d\u540c\u591a\u4e2a\u57df\u540d\uff1a<\/p>\n<p>company.com<\/p>\n<p>company.net<\/p>\n<p>company.org<\/p>\n<p>company.com.cn<\/p>\n<p>company.cn<\/p>\n<p>\u7b49\u7b49\u3002<\/p>\n<p>\u5f88\u81ea\u7136\u8fd9\u4e9b\u57df\u540d\u5168\u90e8\u6307\u5411\u4e00\u4e2a\u7f51\u7ad9\u3002\u5982\u7528company.com\u4e3a\u4e3b\u57df\u540d\uff0c\u5176\u5b83\u57df\u540d\u5c31\u53ef\u4ee5\u8f6c\u5411\u5230company.com\u3002<\/p>\n<p>\u6216\u8005\u4f60\u6ce8\u518c\u4e86\u516c\u53f8\u5168\u79f0\u57df\u540dlongcompanyname.com\uff0c\u4f46\u592a\u957f \uff0c\u4f60\u4e5f\u6ce8\u518c\u4e86\u7f29\u5199\u57df\u540d\u65b9\u4fbf\u7528\u6237\u8bb0\u4f4flcn.com\uff0c\u5176\u4e2d\u4e00\u4e2a\u505a\u4e3b\u57df\u540d\uff0c\u53e6\u4e00\u4e2a\u5c31\u53ef\u4ee5\u8f6c\u5411\u5230\u4e3b\u57df\u540d\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u8981\u7528301\u8f6c\u5411\uff1f<\/p>\n<p>\u7f51\u5740\u8f6c\u5411\u65b9\u6cd5\u4e3b\u8981\u5305\u62ec\uff1a301\u8f6c\u5411\uff0c302\u8f6c\u5411\uff0cJavaScript\u8f6c\u5411\uff0cPHP\/ASP\/CGI\u8f6c\u5411\uff0cMETA REFRESH\u7f51\u9875META\u5237\u65b0\uff0c\u7b49\u3002302\u8f6c\u5411\u53ef\u80fd\u4f1a\u6709URL\u89c4\u8303\u5316\u95ee\u9898\u3002\u5176\u5b83\u65b9\u6cd5\u90fd\u662f\u5e38\u7528\u7684\u4f5c\u5f0a\u624b\u6cd5\uff0c\u5f53\u7136\u4e0d\u662f\u8bf4\u4e0d\u53ef\u4ee5\u6b63\u5f53\u5730\u7528\uff0c\u65b9\u6cd5\u672c\u8eab\u6ca1\u6709\u9519\uff0c\u4f46\u88ab\u4f5c\u5f0a\u8005\u7528\u591a\u4e86\uff0c\u641c\u7d22\u5f15\u64ce\u5bf9\u8fd9\u4e9b\u53ef\u7591\u7684\u8f6c\u5411\u90fd\u5f88\u654f\u611f\u3002\u4f55\u5fc5\u5192\u9669\u5462\u3002<\/p>\n<p>\u5f53\u7f51\u9875A\u7528301\u91cd\u5b9a\u5411\u8f6c\u5230\u7f51\u9875B\u65f6\uff0c\u641c\u7d22\u5f15\u64ce\u53ef\u4ee5\u80af\u5b9a\u7f51\u9875A\u6c38\u4e45\u7684\u6539\u53d8\u4f4d\u7f6e\uff0c\u6216\u8005\u8bf4\u5b9e\u9645\u4e0a\u4e0d\u5b58\u5728\u4e86\uff0c\u641c\u7d22\u5f15\u64ce\u5c31\u4f1a\u628a\u7f51\u9875B\u5f53\u4f5c\u552f\u4e00\u6709\u6548\u76ee\u6807\u3002\u597d\u5904\u662f\uff0c\u7b2c\u4e00\uff0c\u6ca1\u6709\u7f51\u5740\u89c4\u8303\u5316\u95ee\u9898\uff0c\u7b2c\u4e8c\uff0c\u4e5f\u5f88\u91cd\u8981\u7684\uff0c\u7f51\u9875A\u7684PR\u7f51\u9875\u7ea7\u522b\u4f1a\u4f20\u5230\u7f51\u9875B\u3002<\/p>\n<p>\u5f88\u591a\u65f6\u5019\u5176\u5b83\u7f51\u7ad9\u4f1a\u94fe\u63a5\u5230<\/p>\n<p>http:\/\/domainname.com<\/p>\n<p>http:\/\/www.domainname.com\/index.html<\/p>\n<p>http:\/\/domainname.com\/index.html<\/p>\n<p>\u800c\u4e0d\u662f\u4f60\u5e0c\u671b\u7684<\/p>\n<p>http:\/\/www.domainname.com<\/p>\n<p>\u8fd9\u6837\u94fe\u63a5\u7684PR\u4e5f\u4f1a\u4f20\u9012\u5230\u6240\u6709URL\uff0c\u5982\u679c\u4f60\u7528301\u8f6c\u5411\u628a\u524d\u4e09\u4e2aURL\u8f6c\u5230<\/p>\n<p>http:\/\/www.domainname.com<\/p>\n<p>PR\u4e5f\u5c31\u96c6\u4e2d\u5728\u7f51\u9875http:\/\/www.domainname.com\u4e86\u3002<\/p>\n<p>\u5982\u679c\u4f60\u89c9\u5f97\u7f51\u7ad9\u6392\u540d\u6ca1\u6709\u9884\u60f3\u7684\u597d\uff0c\u53ef\u4ee5\u770b\u770b\u662f\u5426\u6709\u7f51\u5740\u89c4\u8303\u5316\u95ee\u9898\uff1a<\/p>\n<p>1) \u67e5\u4e00\u4e0b\u8fd9\u4e9bURL\u662f\u5426\u90fd\u6709\u5dee\u4e0d\u591a\u7684PR\u503c\u548c\u7f51\u9875\u5feb\u7167\uff1a<\/p>\n<p>http:\/\/domainname.com<\/p>\n<p>http:\/\/www.domainname.com\/index.html<\/p>\n<p>http:\/\/domainname.com\/index.html<\/p>\n<p>http:\/\/www.domainname.com<\/p>\n<p>\u5982\u679c\u662f\uff0c\u90a3\u53ef\u80fd\u6709\u95ee\u9898\u3002<\/p>\n<p>2)\u641c\u4e00\u4e0bsite:domain.com\u770b\u662f\u5426\u7ed3\u679c\u4e2d\u6709\u591a\u4e2a\u4e3b\u9875\u7248\u672c\u3002<\/p>\n<p>3)\u4f60\u7684\u7f51\u7ad9\u662f\u5426\u5728Google\u6709\u5927\u91cf\u7f51\u9875\u88ab\u6807\u4e3a\u201c \u8865\u5145\u6750\u6599\u201d(Supplemental Result)\u3002\u4e00\u822c\u8ba4\u4e3a\u88ab\u5f52\u4e3a\u201c \u8865\u5145\u6750\u6599\u201d\u662f\u7f51\u5740\u89c4\u8303\u5316\u95ee\u9898\u7684\u5f81\u5146\u3002<\/p>\n<p>\u600e\u6837\u505a301\u8f6c\u5411<\/p>\n<p>\u5982\u679c\u4f60\u7528\u7684\u662fUnix\/Linux\u4e3b\u673a\uff0c\u53ef\u4ee5\u7528\u6587\u4ef6(Unix\/Linux\u4e2d\u7528\u4e8e\u76ee\u5f55\u7279\u5b9a\u6307\u4ee4\u5982\u5bc6\u7801\uff0c\u8f6c\u5411\uff0c\u9519\u8bef\u5904\u7406\u7b49\u7684\u6587\u4ef6)\u3002<\/p>\n<p>\u6bd4\u5982\u628a\/old.htm\u8f6c\u5230http:\/\/www.domain.com\/new.htm\uff0c\u53ef\u4ee5\u7528\u8fd9\u4e2a\u6307\u4ee4\uff1a<\/p>\n<p>redirect 301 \/old.htm http:\/\/www.domain.com\/new.htm<\/p>\n<p>\u6216<\/p>\n<p>redirect permanent \/old.htm http:\/\/www.domain.com\/new.htm<\/p>\n<p>\u5982\u679c\u8981\u628a\u6240\u6709http:\/\/domain.com\u5f62\u5f0f\u7684URL\u7528301\u91cd\u5b9a\u5411\u8f6c\u5230 http:\/\/www.domain.com\uff0c\u5305\u62ec\uff1a<\/p>\n<p>http:\/\/domain.com\/about.htm<\/p>\n<p>\u8f6c\u5230 http:\/\/www.domain.com\/about.htm<\/p>\n<p>\u53ca<\/p>\n<p>http:\/\/domain.com\/dir\/index.htm<\/p>\n<p>\u8f6c\u5230 http:\/\/www.domain.com\/dir\/index.htm<\/p>\n<p>\u7b49\u7b49\uff0c\u8fd8\u8981\u7528\u5230mod_rewrite\uff1a<\/p>\n<p>Options +FollowSymLinks<\/p>\n<p>RewriteEngine on<\/p>\n<p>RewriteCond %{HTTP_HOST} ^domain.com [NC]<\/p>\n<p>RewriteRule ^(.*)$ http:\/\/www.domain.com\/$1 [L,R=301]<\/p>\n<p>\u5982\u679c\u4f60\u7528\u7684\u662f Windows\u4e3b\u673a\uff0c\u5e94\u8be5\u5728\u63a7\u5236\u9762\u677f\u505a301\u8f6c\u5411\u8bbe\u5b9a\u3002<\/p>\n<p>\u8865\u5145 \uff1a\u5728\u7f51\u5740\u89c4\u8303\u5316\u8bc4\u8bba\u91cc\u56de\u7b54\u77f3\u5934\u738b\u7684\u95ee\u9898\uff0c\u53ef\u80fd\u5bf9\u5927\u5bb6\u6709\u5e2e\u52a9\uff1a<\/p>\n<p>\u636e\u6211\u6240\u77e5\uff0cHTML\u65e0\u6cd5\u505a301\u8f6c\u5411\u3002\u5728HTML\u91cc\u53ea\u80fd\u505aJS\u6216META REFRESH\uff0c\u4f46\u4e0d\u662f301\u8f6c\u5411\u3002HTML\u4e00\u88ab\u8bfb\u53d6\uff0c\u5c31\u5df2\u7ecf\u8fd4\u56de200 OK\u72b6\u6001\u7801\u4e86\u3002<\/p>\n<p>\u5982\u679c\u4f60\u7684\u9875\u9762\u662fASP\u6216PHP\u8fd8\u53ef\u4ee5\u505a301\u8f6c\u5411\uff1a<\/p>\n<p>ASP\uff1a<\/p>\n<p>&lt;%<\/p>\n<p>Response.Status=&quot;301 Moved Permanently&quot; Response.AddHeader &quot;Location&quot;, &quot; http:\/\/www.domain.com&quot;<\/p>\n<p>&gt;<\/p>\n<p>PHP:<\/p>\n<p>Header( \u201cHTTP\/1.1 301 Moved Permanently\u201d );<\/p>\n<p>Header( \u201cLocation: http:\/\/www.domain.com\u201d );<\/p>\n<p>?&gt;<\/p>\n<p>\u53e6\u5916\uff0cDOThtaccess\u6587\u4ef6\u53ea\u662f\u4e00\u4e2a\u666e\u901a\u6587\u5b57\u6587\u4ef6\uff0c\u4f60\u7528Notepad\u5efa\u8fd9\u4e2a\u6587\u4ef6\uff0c\u653e\u4e0a\u6307\u4ee4\uff0c\u5b58\u5728\u4f60\u5e10\u53f7\u7684\u6839\u76ee\u5f55\u4e0b\u5c31\u884c\u4e86\u3002\u4e0d\u9700\u8981\u4fee\u6539Apache\u3002<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>\u9875\u9762\u6c38\u4e45\u6027\u79fb\u8d70\uff08301\u91cd\u5b9a\u5411\uff09\u662f\u4e00\u79cd\u975e\u5e38\u91cd\u8981\u7684\u201c\u81ea\u52a8\u8f6c\u5411\u201d\u6280\u672f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>301\u8f6c\u5411(\u6216\u53eb301\u91cd\u5b9a\u5411\uff0c301\u8df3\u8f6c)\u662f\u5f53\u7528\u6237\u6216\u641c\u7d22\u5f15\u64ce\u5411\u7f51\u7ad9\u670d\u52a1\u5668\u53d1\u51fa\u6d4f\u89c8 &hellip; <a href=\"https:\/\/www.cnmiss.cn\/?p=75\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9],"class_list":["post-75","post","type-post","status-publish","format-standard","hentry","category-xxbj","tag-9"],"_links":{"self":[{"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=\/wp\/v2\/posts\/75","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=75"}],"version-history":[{"count":0,"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=\/wp\/v2\/posts\/75\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=75"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=75"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=75"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}