{"id":61014,"date":"2025-04-26T10:05:36","date_gmt":"2025-04-26T02:05:36","guid":{"rendered":"https:\/\/fwq.ai\/blog\/61014\/"},"modified":"2025-04-26T10:05:36","modified_gmt":"2025-04-26T02:05:36","slug":"zen-cart%e5%b5%8c%e5%a5%97%e7%9b%ae%e5%bd%95%e7%9a%84nginx-rewrite%e8%a7%84%e5%88%99","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/61014\/","title":{"rendered":"Zen Cart\u5d4c\u5957\u76ee\u5f55\u7684Nginx Rewrite\u89c4\u5219"},"content":{"rendered":"<p>Zen Cart\u5d4c\u5957\u76ee\u5f55\u7684Nginx Rewrite\u89c4\u5219,Zen Cart V1.5.1\uff0cUltimate SEO 2.212,nginx\/1.4.2\u4e0b\u6d4b\u8bd5\u901a\u8fc7  &nbsp;   \u5b8c\u6574\u89c4\u5219\u5982\u4e0b   &nbsp;   &nbsp;   &nbsp; &nbsp; # if the requested file exists, return it immediately   &nbsp; &nbsp; if (-f $request_filename) {   &nbsp; &nbsp; &nbsp; &nbsp; break;   &nbsp; &nbsp; }   &nbsp; &nbsp; #For Ultimate SEO URLs   &nbsp; &nbsp; rewrite ^\/(.*)-p-([0-9]+).html$ \/index.php?main_page=product_info&amp;products_id=$2&amp;$args last;   &nbsp; &nbsp; rewrite ^\/(.*)-c-([0-9]+)_([0-9]+)\/$ \/index.php?main_page=index&amp;cPath=$2_$3&amp;$args last;   &nbsp; &nbsp; rewrite ^\/(.*)-c-([0-9]+)\/$ \/index.php?main_page=index&amp;cPath=$2&amp;$args last;   &nbsp; &nbsp; rewrite ^\/(.*)-m-([0-9]+).html$ \/index.php?main_page=index&amp;manufacturers_id=$2&amp;$args last;   &nbsp; &nbsp; rewrite ^\/(.*)-pi-([0-9]+).html$ \/index.php?main_page=popup_image&amp;pID=$2&amp;$args last;   &nbsp; &nbsp; rewrite ^\/(.*)-pr-([0-9]+).html$ \/index.php?main_page=product_reviews&amp;products_id=$2&amp;$args last;   &nbsp; &nbsp; rewrite ^\/(.*)-pri-([0-9]+).html$ \/index.php?main_page=product_reviews_info&amp;products_id=$2&amp;$args last;   &nbsp;   # For eazy pages   &nbsp; &nbsp; rewrite ^\/(.*)-ezp-([0-9]+).html$ \/index.php?main_page=page&amp;id=$2&amp;$args last;   &nbsp;   # For Open Operations Info Manager   &nbsp; &nbsp; rewrite ^\/(.*)-i-([0-9]+).html$ \/index.php?main_page=info_manager&amp;pages_id=$2&amp;$args last;   &nbsp;   # For dreamscape&#8217;s News &amp; Articles Manager   rewrite &#8220;^news\/?&#8221; \/index.php?main_page=news&amp;% last;   rewrite &#8220;^news\/rss.xml&#8221; \/index.php?main_page=news_rss&amp;% last;   rewrite &#8220;^news\/archive\/?&#8221; \/index.php?main_page=news_archive&amp;% last;   rewrite &#8220;^news\/([0-9]{4})-([0-9]{2})-([0-9]{2}).html&#8221; \/index.php?main_page=news&amp;date=$1-$2-$3&amp;% last;   rewrite &#8220;^news\/archive\/([0-9]{4})-([0-9]{2}).html&#8221; \/index.php?main_page=news_archive&amp;date=$1-$2&amp;% last;   rewrite &#8220;^news\/(.*)-a-([0-9]+)-comments.html&#8221; \/index.php?main_page=news_comments&amp;article_id=$2&amp;% last;   rewrite &#8220;^news\/(.*)-a-([0-9]+).html&#8221; \/index.php?main_page=news_article&amp;article_id=$2&amp;% last;   &nbsp;&nbsp;   # All other pages   # Don&#8217;t rewrite real files or directories   rewrite &#8220;^(.*).html&#8221; \/index.php?main_page=$1&amp;% last;   \u8bf7\u6ce8\u610f\u8fd9\u6761Rewrite\u89c4\u5219\uff0c\u8fd9\u5c31\u662f\u5d4c\u5957\u76ee\u5f55\u89c4\u5219   &nbsp;   1   rewrite ^\/(.*)-c-([0-9]+)_([0-9]+)\/$ \/index.php?main_page=index&amp;cPath=$2_$3&amp;$args last;   \u9644\u5f55\uff0cWordpress\u5b89\u88c5\u5728\u5b50\u76ee\u5f55\u65f6\u7684Rewrite \u89c4\u5219   &nbsp;   &nbsp;   &nbsp; &nbsp; location \/ {   &nbsp;   &nbsp; &nbsp; rewrite ^\/blog\/wp-admin$ \/blog\/wp-admin\/ permanent;   &nbsp;   &nbsp; &nbsp; if (-f $request_filename\/index.html){   &nbsp; &nbsp; &nbsp; &nbsp; rewrite ^\/blog\/(.*) \/blog\/$1\/index.html break;   &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; if (-f $request_filename\/index.php){   &nbsp; &nbsp; &nbsp; &nbsp; rewrite ^\/blog\/(.*) \/blog\/$1\/index.php;   &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; if (!-f $request_filename){   &nbsp; &nbsp; &nbsp; &nbsp; rewrite ^\/blog\/(.*) \/blog\/index.php;   &nbsp; &nbsp; }   }   &nbsp;  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Zen Cart\u5d4c\u5957\u76ee\u5f55\u7684Nginx Rewrite\u89c4\u5219,Zen Cart V1.5.1\uff0cUltimate SEO 2.212,nginx\/1.4.2\u4e0b\u6d4b\u8bd5\u901a\u8fc7 &nbsp; \u5b8c\u6574\u89c4\u5219\u5982\u4e0b &nbsp; &nbsp; &nbsp; &nbsp; # if the requested file exists, return it immediately &nbsp; &nbsp; if (-f $request_filename) { &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; } &nbsp; &nbsp; #For Ultimate SEO URLs &nbsp; &nbsp; rewrite ^\/(.*)-p-([0-9]+).html$ \/index.php?main_page=product_info&amp;products_id=$2&amp;$args last; &nbsp; &nbsp; rewrite ^\/(.*)-c-([0-9]+)_([0-9]+)\/$ \/index.php?main_page=index&amp;cPath=$2_$3&amp;$args last; &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-61014","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/61014","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=61014"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/61014\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=61014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=61014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=61014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}