{"id":2322,"date":"2013-10-12T08:21:11","date_gmt":"2013-10-12T00:21:11","guid":{"rendered":"https:\/\/sdeno.com\/?p=2322"},"modified":"2013-10-12T08:21:11","modified_gmt":"2013-10-12T00:21:11","slug":"wordpress%e5%9c%a8iis7-5-%e4%b8%8b%e7%9a%84%e4%bc%aa%e9%9d%99%e6%80%81%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/sdeno.com\/?p=2322","title":{"rendered":"wordpress\u5728IIS7.5 \u4e0b\u7684\u4f2a\u9759\u6001\u89e3\u51b3\u65b9\u6cd5"},"content":{"rendered":"<p>\u65b0\u5efa\u4e00\u4e2a\u201cchineseurl.php\u201d\u6587\u4ef6\uff1a<br \/>\n<span style=\"color: #333333; font-style: normal; line-height: 24px;\">[code]<\/span>&lt;?php<\/p>\n<p>\/\/ IIS Mod-Rewrite<br \/>\nif (isset($_SERVER[&#8216;HTTP_X_ORIGINAL_URL&#8217;])) {<br \/>\n$_SERVER[&#8216;REQUEST_URI&#8217;] = $_SERVER[&#8216;HTTP_X_ORIGINAL_URL&#8217;];<br \/>\n}<br \/>\n\/\/ IIS Isapi_Rewrite<br \/>\nelse if (isset($_SERVER[&#8216;HTTP_X_REWRITE_URL&#8217;])) {<br \/>\n$_SERVER[&#8216;REQUEST_URI&#8217;] = $_SERVER[&#8216;HTTP_X_REWRITE_URL&#8217;];<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n\/\/ Use ORIG_PATH_INFO if there is no PATH_INFO<br \/>\nif ( !isset($_SERVER[&#8216;PATH_INFO&#8217;]) &amp;&amp; isset($_SERVER[&#8216;ORIG_PATH_INFO&#8217;]) )<br \/>\n$_SERVER[&#8216;PATH_INFO&#8217;] = $_SERVER[&#8216;ORIG_PATH_INFO&#8217;];<\/p>\n<p>\/\/ Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)<br \/>\nif ( isset($_SERVER[&#8216;PATH_INFO&#8217;]) ) {<br \/>\nif ( $_SERVER[&#8216;PATH_INFO&#8217;] == $_SERVER[&#8216;SCRIPT_NAME&#8217;] )<br \/>\n$_SERVER[&#8216;REQUEST_URI&#8217;] = $_SERVER[&#8216;PATH_INFO&#8217;];<br \/>\nelse<br \/>\n$_SERVER[&#8216;REQUEST_URI&#8217;] = $_SERVER[&#8216;SCRIPT_NAME&#8217;] . $_SERVER[&#8216;PATH_INFO&#8217;];<br \/>\n}<\/p>\n<p>\/\/ Append the query string if it exists and isn&#8217;t null<br \/>\nif (isset($_SERVER[&#8216;QUERY_STRING&#8217;]) &amp;&amp; !empty($_SERVER[&#8216;QUERY_STRING&#8217;])) {<br \/>\n$_SERVER[&#8216;REQUEST_URI&#8217;] .= &#8216;?&#8217; . $_SERVER[&#8216;QUERY_STRING&#8217;];<br \/>\n}<br \/>\n}<\/p>\n<p>require(&#8220;index.php&#8221;);<\/p>\n<p>?&gt;[\/code]<\/p>\n<p>\u4fee\u6539 web.config \u6587\u4ef6\uff1a<\/p>\n<p>[code]&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br \/>\n&lt;configuration&gt;<br \/>\n&lt;system.webServer&gt;<br \/>\n&lt;rewrite&gt;<br \/>\n&lt;rules&gt;<br \/>\n&lt;rule name=&#8221;ChineseURL&#8221; stopProcessing=&#8221;true&#8221;&gt;<br \/>\n&lt;match url=&#8221;^(tag|category)\/(.*)$&#8221; \/&gt;<br \/>\n&lt;action type=&#8221;Rewrite&#8221; url=&#8221;chineseurl.php&#8221;\/&gt;<br \/>\n&lt;\/rule&gt;<br \/>\n&lt;rule name=&#8221;wordpress&#8221; patternSyntax=&#8221;Wildcard&#8221;&gt;<br \/>\n&lt;match url=&#8221;*&#8221; \/&gt;<br \/>\n&lt;conditions&gt;<br \/>\n&lt;add input=&#8221;{REQUEST_FILENAME}&#8221; matchType=&#8221;IsFile&#8221; negate=&#8221;true&#8221; \/&gt;<br \/>\n&lt;add input=&#8221;{REQUEST_FILENAME}&#8221; matchType=&#8221;IsDirectory&#8221; negate=&#8221;true&#8221; \/&gt;<br \/>\n&lt;\/conditions&gt;<br \/>\n&lt;action type=&#8221;Rewrite&#8221; url=&#8221;index.php&#8221; \/&gt;<br \/>\n&lt;\/rule&gt;<br \/>\n&lt;\/rules&gt;<br \/>\n&lt;\/rewrite&gt;<br \/>\n&lt;\/system.webServer&gt;<br \/>\n&lt;\/configuration&gt;<br \/>\n\u4e24\u4e2a\u6587\u4ef6\u90fd\u4fdd\u5b58\u5728 WordPress \u7684\u5b89\u88c5\u76ee\u5f55\u4e0b\u3002<\/p>\n<p>\u82e5 WordPress \u4e0d\u662f\u88c5\u5728\u6839\u76ee\u5f55\uff0c\u5219\u9700\u8981\u4fee\u6539\u201c&lt;match url=\u201d^(tag|category)\/(.*)$\u201d \/&gt;\u201d\u4e3a\u201c&lt;match url=\u201d^\u5b89\u88c5\u76ee\u5f55\/(tag|category)\/(.*)$\u201d \/&gt;\u201d\u3002\u5982\u679c\u5728\u56fa\u5b9a\u94fe\u63a5\u8bbe\u7f6e\u91cc\u628a\u9ed8\u8ba4\u7684\u6807\u7b7e\u524d\u7f00\u548c\u5206\u7c7b\u76ee\u5f55\u524d\u7f00\uff08tag \u548c category\uff09\u6539\u4e86\uff0c\u5219\u66f4\u6539\u8fd9\u53e5\u91cc\u7684\u5bf9\u5e94\u5185\u5bb9\u5373\u53ef\u3002<br \/>\n\u5168\u5c40\u7531chineseurl.php\u5904\u7406<br \/>\n&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br \/>\n&lt;configuration&gt;<br \/>\n&lt;system.webServer&gt;<br \/>\n&lt;rewrite&gt;<br \/>\n&lt;rules&gt;<br \/>\n&lt;rule name=&#8221;ChineseURL&#8221; stopProcessing=&#8221;true&#8221;&gt;<br \/>\n&lt;match url=&#8221;^(.*)$&#8221; \/&gt;<br \/>\n&lt;conditions&gt;<br \/>\n&lt;add input=&#8221;{REQUEST_FILENAME}&#8221; matchType=&#8221;IsFile&#8221; negate=&#8221;true&#8221; \/&gt;<br \/>\n&lt;add input=&#8221;{REQUEST_FILENAME}&#8221; matchType=&#8221;IsDirectory&#8221; negate=&#8221;true&#8221; \/&gt;<br \/>\n&lt;\/conditions&gt;<br \/>\n&lt;action type=&#8221;Rewrite&#8221; url=&#8221;chineseurl.php&#8221;\/&gt;<br \/>\n&lt;\/rule&gt;<br \/>\n&lt;\/rules&gt;<br \/>\n&lt;\/rewrite&gt;<br \/>\n&lt;\/system.webServer&gt;<br \/>\n&lt;\/configuration&gt;[\/code]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65b0\u5efa\u4e00\u4e2a\u201cchineseurl.php\u201d\u6587\u4ef6\uff1a [code]&lt;?php \/\/ IIS Mod-Rewri [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,11],"tags":[],"class_list":["post-2322","post","type-post","status-publish","format-standard","hentry","category-wordpress","category-11"],"_links":{"self":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/2322","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2322"}],"version-history":[{"count":0,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/2322\/revisions"}],"wp:attachment":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}