{"id":59126,"date":"2025-04-23T10:31:08","date_gmt":"2025-04-23T02:31:08","guid":{"rendered":"https:\/\/fwq.ai\/blog\/59126\/"},"modified":"2025-04-23T10:31:08","modified_gmt":"2025-04-23T02:31:08","slug":"ecshop%e7%b3%bb%e7%bb%9furl%e9%87%8d%e5%86%99%e7%9a%84%e4%b8%80%e4%ba%9b%e7%bb%86%e8%8a%82%e4%bc%98%e5%8c%96","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/59126\/","title":{"rendered":"ECSHOP\u7cfb\u7edfurl\u91cd\u5199\u7684\u4e00\u4e9b\u7ec6\u8282\u4f18\u5316"},"content":{"rendered":"<p>\u76ee\u524decshop\u7684<span>\u91cd\u5199<\/span>\u5f00\u542f\u540e\uff0c2\u79cd\u91cd\u5199\u65b9\u5f0f\u53caphp<span>\u6587\u4ef6<\/span>\u90fd\u662f\u53ef\u4ee5\u8bbf\u95ee\u7684\uff0c\u8fd9\u6837\u5728<span>\u641c\u7d22<\/span>\u5f15\u64ce\u4f18\u5316\u4e2d\u5b58\u5728\u4e00\u4e9b\u5f0a\u75c5\uff0c\u5982\u679c\u7f51\u7ad9\u7684\u5185\u5bb9\u8f83\u591a\uff0c\u5c06\u4f1a\u51fa\u73b0\u5927\u91cf\u91cd\u590d<span>\u9875\u9762<\/span>\uff0c\u5f88\u53ef\u80fd\u4f1a\u88ab\u5224\u5b9a\u4e3a**\uff0c<span>\u5efa\u8bae<\/span>\u66f4\u6539\u4e3a\u5f00\u542f\u91cd\u5199\u540e\uff0c\u53ea\u6709\u9009\u5b9a\u7684\u65b9\u5f0f\u6709\u6548\uff0c\u4e3e\u4f8b\u8bf4\u660e\u5982\u4e0b\uff1a<br \/> \u5f00\u542f\u7b80\u5355\u91cd\u5199\u5219\uff1a<br \/> 1\u3001\u8bbf\u95ee\u7f51\u7ad9\u7b80\u5355\u91cd\u5199\u540e\u7684<span>URL<\/span>\u6709\u6548\uff1b<br \/> 2\u3001\u590d\u6742\u91cd\u5199\u53ca.php\u540e\u7f00\u7684URL\u5747\u65e0\u6548\uff0c\u8fd4\u56de404+\u5ef6\u65f6\u8f6c\u5411\u6216\u91c7\u7528301\u8f6c\u5411<span>\u9996\u9875<\/span><\/p>\n<p><span>\u7b80\u5355\u7684\u4fee\u6539\u529e\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p> \u5728GOODS.PHP \u7684 <\/span><\/p>\n<ol>\n<li>$cache_id = sprintf(&#8216;%X&#8217;, crc32($cache_id));<\/li>\n<\/ol>\n<p><em>\u590d\u5236\u4ee3\u7801<\/em>  <\/p>\n<p>\u4e0a\u9762\u52a0\u4e0a<\/p>\n<ol>\n<li>$goods_page_url = build_uri(&#8216;goods&#8217;, array(&#8216;gid&#8217;=&gt;$goods_id), &#8221;);<br \/> &nbsp;<\/li>\n<li>if(&#8220;http:\/\/&#8221; . $_SERVER[SERVER_NAME] . $_SERVER[REQUEST_URI] !== $goods_page_url)<br \/> &nbsp;<\/li>\n<li>{<br \/> &nbsp;<\/li>\n<li>&nbsp; &nbsp; &nbsp; &nbsp; header(&#8220;HTTP\/1.1 301 Moved Permanently&#8221;);<br \/> &nbsp;<\/li>\n<li>&nbsp; &nbsp; &nbsp; &nbsp; header(&#8220;Location: $goods_page_url&#8221;);<br \/> &nbsp;<\/li>\n<li>&nbsp; &nbsp; &nbsp; &nbsp; exit();<br \/> &nbsp;<\/li>\n<li>}<\/li>\n<\/ol>\n<p><em>\u590d\u5236\u4ee3\u7801<\/em>  <\/p>\n<p>\u5728article.php \u7684<\/p>\n<ol>\n<li>$cache_id = sprintf(&#8216;%X&#8217;, crc32($_REQUEST[&#8216;id&#8217;] . &#8216;-&#8216; . $_CFG[&#8216;lang&#8217;]));<\/li>\n<\/ol>\n<p><em>\u590d\u5236\u4ee3\u7801<\/em>  <\/p>\n<p>\u4e0a\u9762\u52a0\u4e0a<\/p>\n<ol>\n<li>$article_page_url = build_uri(&#8216;article&#8217;, array(&#8216;aid&#8217;=&gt;$article_id), &#8221;);<br \/> &nbsp;<\/li>\n<li> &nbsp;<\/li>\n<li>if(&#8220;http:\/\/&#8221; . $_SERVER[SERVER_NAME] . $_SERVER[REQUEST_URI] !== $article_page_url)<br \/> &nbsp;<\/li>\n<li>{<br \/> &nbsp;<\/li>\n<li>&nbsp; &nbsp; &nbsp; &nbsp; header(&#8220;HTTP\/1.1 301 Moved Permanently&#8221;);<br \/> &nbsp;<\/li>\n<li>&nbsp; &nbsp; &nbsp; &nbsp; header(&#8220;Location: $article_page_url&#8221;);<br \/> &nbsp;<\/li>\n<li>&nbsp; &nbsp; &nbsp; &nbsp; exit();<br \/> &nbsp;<\/li>\n<li>}<\/li>\n<\/ol>\n<p><em>\u590d\u5236\u4ee3\u7801<\/em>  <\/p>\n<p>\u5176\u5b83\u9875\u9762\u7c7b\u4f3c\uff0c\u7531\u4e8e\u6211\u7684\u7a0b\u5e8f\u5176\u4ed6\u9875\u9762\u4fee\u6539\u8f83\u5927\uff0c\u4fee\u6539\u65b9\u6cd5\u5bf9\u5176\u4ed6ECSHOP\u7528\u6237\u6ca1\u6709\u53c2\u8003\u4ef7\u503c\uff0c\u5c31\u4e0d\u5217\u51fa\u6765\u4e86\uff0c\u5927\u6982\u601d\u8def\u5c31\u662f\u8fd9\u6837\u7684\u3002<br \/> &nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u524decshop\u7684\u91cd\u5199\u5f00\u542f\u540e\uff0c2\u79cd\u91cd\u5199\u65b9\u5f0f\u53caphp\u6587\u4ef6\u90fd\u662f\u53ef\u4ee5\u8bbf\u95ee\u7684\uff0c\u8fd9\u6837\u5728\u641c\u7d22\u5f15\u64ce\u4f18\u5316\u4e2d\u5b58\u5728\u4e00\u4e9b\u5f0a\u75c5\uff0c\u5982\u679c\u7f51\u7ad9\u7684\u5185\u5bb9\u8f83\u591a\uff0c\u5c06\u4f1a\u51fa\u73b0\u5927\u91cf\u91cd\u590d\u9875\u9762\uff0c\u5f88\u53ef\u80fd\u4f1a\u88ab\u5224\u5b9a\u4e3a**\uff0c\u5efa\u8bae\u66f4\u6539\u4e3a\u5f00\u542f\u91cd\u5199\u540e\uff0c\u53ea\u6709\u9009\u5b9a\u7684\u65b9\u5f0f\u6709\u6548\uff0c\u4e3e\u4f8b\u8bf4\u660e\u5982\u4e0b\uff1a \u5f00\u542f\u7b80\u5355\u91cd\u5199\u5219\uff1a 1\u3001\u8bbf\u95ee\u7f51\u7ad9\u7b80\u5355\u91cd\u5199\u540e\u7684URL\u6709\u6548\uff1b 2\u3001\u590d\u6742\u91cd\u5199\u53ca.php\u540e\u7f00\u7684URL\u5747\u65e0\u6548\uff0c\u8fd4\u56de404+\u5ef6\u65f6\u8f6c\u5411\u6216\u91c7\u7528301\u8f6c\u5411\u9996\u9875 \u7b80\u5355\u7684\u4fee\u6539\u529e\u6cd5\u5982\u4e0b\uff1a \u5728GOODS.PHP \u7684 $cache_id = sprintf(&#8216;%X&#8217;, crc32($cache_id)); \u590d\u5236\u4ee3\u7801 \u4e0a\u9762\u52a0\u4e0a $goods_page_url = build_uri(&#8216;goods&#8217;, array(&#8216;gid&#8217;=&gt;$goods_id), &#8221;); &nbsp; if(&#8220;http:\/\/&#8221; . $_SERVER[SERVER_NAME] . $_SERVER[REQUEST_URI] !== $goods_page_url) &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; header(&#8220;HTTP\/1.1 301 Moved Permanently&#8221;); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; header(&#8220;Location: $goods_page_url&#8221;); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit(); &nbsp; } \u590d\u5236\u4ee3\u7801 \u5728article.php \u7684 [&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-59126","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/59126","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=59126"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/59126\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=59126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=59126"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=59126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}