{"id":60754,"date":"2025-04-26T09:05:17","date_gmt":"2025-04-26T01:05:17","guid":{"rendered":"https:\/\/fwq.ai\/blog\/60754\/"},"modified":"2025-04-26T09:05:17","modified_gmt":"2025-04-26T01:05:17","slug":"zencart%e7%bd%91%e5%ba%97%e7%b3%bb%e7%bb%9f301%e9%87%8d%e5%ae%9a%e5%90%91","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/60754\/","title":{"rendered":"zencart\u7f51\u5e97\u7cfb\u7edf301\u91cd\u5b9a\u5411"},"content":{"rendered":"<p> \u5f53\u4f60zencart\u7f51\u7ad9\u53d7\u5230\u641c\u7d22\u5f15\u64ce\u60e9\u7f5a\u7684\u65f6\u5019\u7ecf\u5e38\u8981\u66f4\u6362\u65b0\u57df\u540d\uff0c\u5e76\u5c06\u8fc7\u53bb\u7684\u57df\u540d\u7684\u6240\u6709url\u5e73\u6ed1\u91cd\u5b9a\u5411\u5230\u65b0\u7684\u57df\u540d\uff0c\u4e0b\u9762\u8c08\u8c08\u600e\u6837\u8fdb\u884c\u65b0\u65e7\u57df\u540d301\u91cd\u5b9a\u5411<\/p>\n<h2> \u4e00\u3001apache\u670d\u52a1\u5668\u4e14\u5f00\u542f\u4e86\u4f2a\u9759\u6001\u5b9e\u73b0301\u8df3\u8f6c<\/h2>\n<p> \u5728\u9700\u8981\u8df3\u8f6c\u7684aaa.com\u7f51\u7ad9\u6839\u76ee\u5f55\u4e0b\u7684.htaccess\u6587\u4ef6RewriteBase \/\u540e\u9762\u52a0\u4e0a\u4e0b\u5217\u4ee3\u7801<\/p>\n<p> &nbsp;<\/p>\n<p> RewriteCond %{http_host} ^www.aaa.com [NC]<\/p>\n<p> RewriteRule ^(.*)$ http:\/\/www.bbb.com\/$1 [L,R=301]<\/p>\n<p> RewriteCond %{http_host} ^aaa.com [NC]<\/p>\n<p> RewriteRule ^(.*)$ http:\/\/www.bbb.com\/$1 [L,R=301]<\/p>\n<p> &nbsp;<\/p>\n<h2> \u4e8c\u3001nginx\u670d\u52a1\u5668\u5b9e\u73b0301\u8df3\u8f6c<\/h2>\n<p> \u5728\u9700\u8981\u8df3\u8f6c\u7684aaa.com\u7f51\u7ad9\u670d\u52a1\u5668\u4e0b\u7684nginx.conf\u6587\u4ef6server\u6bb5\u57df\u540d\u4e0b\u6216\u8005\u7f51\u7ad9\u5bf9\u5e94\u7684conf\u914d\u7f6e\u6587\u4ef6\u4e2d\u52a0\u4e0a\u4e0b\u9762\u4ee3\u7801\uff1a<\/p>\n<p> &nbsp;<\/p>\n<pre>\r\nif ($host = 'aaa.com' ) { &nbsp; &nbsp; &nbsp;&nbsp;<\/pre>\n<p> &nbsp;<\/p>\n<p> &nbsp;rewrite ^\/(.*)$ http:\/\/www.bbb.com\/$1 permanent;&nbsp;<\/p>\n<p> }<\/p>\n<p> if ($host = &#8216;www.aaa.com&#8217; ) { &nbsp; &nbsp; &nbsp; &nbsp;<\/p>\n<p> rewrite ^\/(.*)$ http:\/\/www.bbb.com\/$1 permanent;&nbsp;<\/p>\n<p> }<\/p>\n<p> &nbsp;<\/p>\n<p> \u91cd\u542fnginx\uff0c\u8fd9\u6837\u6211\u4eec\u5c31\u5b8c\u6210\u4e86nginx\u4e0b301\u7684\u8df3\u8f6c\u8bbe\u7f6e\u3002<\/p>\n<p> \u4e0a\u9762\u8bed\u53e5\u7684\u610f\u601d\u662f\u5c06\u57df\u540d\u4e3aaaa.com\u7684\u4efb\u4f55url\u8df3\u8f6c\u5230\u5bf9\u5e94bbb.com\u7f51\u7ad9url\uff0c\u5b9e\u73b0\u5e73\u6ed1\u8df3\u8f6c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u4f60zencart\u7f51\u7ad9\u53d7\u5230\u641c\u7d22\u5f15\u64ce\u60e9\u7f5a\u7684\u65f6\u5019\u7ecf\u5e38\u8981\u66f4\u6362\u65b0\u57df\u540d\uff0c\u5e76\u5c06\u8fc7\u53bb\u7684\u57df\u540d\u7684\u6240\u6709url\u5e73\u6ed1\u91cd\u5b9a\u5411\u5230\u65b0\u7684\u57df\u540d\uff0c\u4e0b\u9762\u8c08\u8c08\u600e\u6837\u8fdb\u884c\u65b0\u65e7\u57df\u540d301\u91cd\u5b9a\u5411 \u4e00\u3001apache\u670d\u52a1\u5668\u4e14\u5f00\u542f\u4e86\u4f2a\u9759\u6001\u5b9e\u73b0301\u8df3\u8f6c \u5728\u9700\u8981\u8df3\u8f6c\u7684aaa.com\u7f51\u7ad9\u6839\u76ee\u5f55\u4e0b\u7684.htaccess\u6587\u4ef6RewriteBase \/\u540e\u9762\u52a0\u4e0a\u4e0b\u5217\u4ee3\u7801 &nbsp; RewriteCond %{http_host} ^www.aaa.com [NC] RewriteRule ^(.*)$ http:\/\/www.bbb.com\/$1 [L,R=301] RewriteCond %{http_host} ^aaa.com [NC] RewriteRule ^(.*)$ http:\/\/www.bbb.com\/$1 [L,R=301] &nbsp; \u4e8c\u3001nginx\u670d\u52a1\u5668\u5b9e\u73b0301\u8df3\u8f6c \u5728\u9700\u8981\u8df3\u8f6c\u7684aaa.com\u7f51\u7ad9\u670d\u52a1\u5668\u4e0b\u7684nginx.conf\u6587\u4ef6server\u6bb5\u57df\u540d\u4e0b\u6216\u8005\u7f51\u7ad9\u5bf9\u5e94\u7684conf\u914d\u7f6e\u6587\u4ef6\u4e2d\u52a0\u4e0a\u4e0b\u9762\u4ee3\u7801\uff1a &nbsp; if ($host = &#8216;aaa.com&#8217; ) { &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;rewrite ^\/(.*)$ http:\/\/www.bbb.com\/$1 permanent;&nbsp; } if ($host = &#8216;www.aaa.com&#8217; ) { &nbsp; &nbsp; &nbsp; &nbsp; rewrite ^\/(.*)$ http:\/\/www.bbb.com\/$1 permanent;&nbsp; } [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-60754","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=60754"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60754\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=60754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=60754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=60754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}