{"id":199118,"date":"2025-05-03T10:02:47","date_gmt":"2025-05-03T02:02:47","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199118\/"},"modified":"2025-05-03T10:02:47","modified_gmt":"2025-05-03T02:02:47","slug":"ecshop-%e5%9c%a8nginx%e4%b8%8b%e7%9a%84%e9%93%be%e6%8e%a5%e9%87%8d%e5%86%99url-rewrite-%e4%bc%aa%e9%9d%99%e6%80%81%e8%a7%84%e5%88%99","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199118\/","title":{"rendered":"ecshop \u5728nginx\u4e0b\u7684\u94fe\u63a5\u91cd\u5199(url rewrite \u4f2a\u9759\u6001)\u89c4\u5219"},"content":{"rendered":"<p>&nbsp;ecshop \u5728nginx\u4e0b\u7684\u94fe\u63a5\u91cd\u5199(url rewrite \u4f2a\u9759\u6001)\u89c4\u5219<\/p>\n<\/p>\n<p>if (!-e $request_filename)<\/p>\n<p>{<\/p>\n<p>rewrite &#8220;^\/index\\.html&#8221; \/index.php last;<\/p>\n<p>rewrite &#8220;^\/category$&#8221; \/index.php last;<\/p>\n<p>rewrite &#8220;^\/feed-c([0-9]+)\\.xml$\u201d \/feed.php?cat=$1 last;<\/p>\n<p>rewrite \u201c^\/feed-b([0-9]+)\\.xml$\u201d \/feed.php?brand=$1 last;<\/p>\n<p>rewrite \u201c^\/feed\\.xml$\u201d \/feed.php last;<\/p>\n<p>rewrite \u201c^\/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\\.html$\u201d \/category.php?id=$1&amp;brand=$2&amp;price_min=$3&amp;price_max=$4&amp;filter_attr=$5&amp;page=$6&amp;sort=$7&amp;order=$8 last;<\/p>\n<p>rewrite \u201c^\/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\\.html$\u201d \/category.php?id=$1&amp;brand=$2&amp;price_min=$3&amp;price_max=$4&amp;filter_attr=$5 last;<\/p>\n<p>rewrite \u201c^\/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\\.html$\u201d \/category.php?id=$1&amp;brand=$2&amp;page=$3&amp;sort=$4&amp;order=$5 last;<\/p>\n<p>rewrite \u201c^\/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\\.html$\u201d \/category.php?id=$1&amp;brand=$2&amp;page=$3 last;<\/p>\n<p>rewrite \u201c^\/category-([0-9]+)-b([0-9]+)(.*)\\.html$\u201d \/category.php?id=$1&amp;brand=$2 last;<\/p>\n<p>rewrite \u201c^\/category-([0-9]+)(.*)\\.html$\u201d \/category.php?id=$1 last;<\/p>\n<p>rewrite \u201c^\/goods-([0-9]+)(.*)\\.html\u201d \/goods.php?id=$1 last;<\/p>\n<p>rewrite \u201c^\/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\\.html$\u201d \/article_cat.php?id=$1&amp;page=$2&amp;sort=$3&amp;order=$4 last;<\/p>\n<p>rewrite \u201c^\/article_cat-([0-9]+)-([0-9]+)(.*)\\.html$\u201d \/article_cat.php?id=$1&amp;page=$2 last;<\/p>\n<p>rewrite \u201c^\/article_cat-([0-9]+)(.*)\\.html$\u201d \/article_cat.php?id=$1 last;<\/p>\n<p>rewrite \u201c^\/article-([0-9]+)(.*)\\.html$\u201d \/article.php?id=$1 last;<\/p>\n<p>rewrite \u201c^\/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\\.html\u201d \/brand.php?id=$1&amp;cat=$2&amp;page=$3&amp;sort=$4&amp;order=$5 last;<\/p>\n<p>rewrite \u201c^\/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\\.html\u201d \/brand.php?id=$1&amp;cat=$2&amp;page=$3 last;<\/p>\n<p>rewrite \u201c^\/brand-([0-9]+)-c([0-9]+)(.*)\\.html\u201d \/brand.php?id=$1&amp;cat=$2 last;<\/p>\n<p>rewrite \u201c^\/brand-([0-9]+)(.*)\\.html\u201d \/brand.php?id=$1 last;<\/p>\n<p>rewrite \u201c^\/tag-(.*)\\.html\u201d \/search.php?keywords=$1 last;<\/p>\n<p>rewrite \u201c^\/snatch-([0-9]+)\\.html$\u201d \/snatch.php?id=$1 last;<\/p>\n<p>rewrite \u201c^\/group_buy-([0-9]+)\\.html$\u201d \/group_buy.php?act=view&amp;id=$1 last;<\/p>\n<p>rewrite \u201c^\/auction-([0-9]+)\\.html$\u201d \/auction.php?act=view&amp;id=$1 last;<\/p>\n<p>rewrite \u201c^\/exchange-id([0-9]+)(.*)\\.html$\u201d \/exchange.php?id=$1&amp;act=view last;<\/p>\n<p>rewrite \u201c^\/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\\.html$\u201d \/exchange.php?cat_id=$1&amp;integral_min=$2&amp;integral_max=$3&amp;page=$4&amp;sort=$5&amp;order=$6 last;<\/p>\n<p>rewrite ^\/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\\.html$\u201d \/exchange.php?cat_id=$1&amp;page=$2&amp;sort=$3&amp;order=$4 last;<\/p>\n<p>rewrite \u201c^\/exchange-([0-9]+)-([0-9]+)(.*)\\.html$\u201d \/exchange.php?cat_id=$1&amp;page=$2 last;<\/p>\n<p>rewrite \u201c^\/exchange-([0-9]+)(.*)\\.html$\u201d \/exchange.php?cat_id=$1 last;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>}<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;ecshop \u5728ng&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-199118","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=199118"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199118\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}