{"id":31794,"date":"2024-11-25T09:05:34","date_gmt":"2024-11-25T01:05:34","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31794\/"},"modified":"2024-11-25T09:05:34","modified_gmt":"2024-11-25T01:05:34","slug":"wordpress%e5%8e%bb%e9%99%a4index-php%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31794\/","title":{"rendered":"wordpress\u53bb\u9664index.php\u7684\u65b9\u6cd5"},"content":{"rendered":"<blockquote><p>\n  wordpress\u53bb\u9664index.php\u7684\u65b9\u6cd5\uff1a\u9996\u5148\u767b\u5f55wordpress\u540e\u53f0\uff1b\u7136\u540e\u4f9d\u6b21\u9009\u62e9\u201c\u8bbe\u7f6e-\u56fa\u5b9a\u94fe\u63a5\u201d\u5e76\u8bbe\u7f6e\u597d\u94fe\u63a5\uff1b\u63a5\u7740\u8bbe\u7f6ewordpress\u91cd\u5199\u89c4\u5219\uff1b\u6700\u540e\u5728wordpress\u7f51\u7ad9\u76ee\u5f55\u4e0b\u65b0\u5efahtaccess\u6587\u4ef6\u5373\u53ef\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/020\/5f50526b0cc5b483.jpg\" class=\"aligncenter\" title=\"wordpress\u53bb\u9664index.php\u7684\u65b9\u6cd5\u63d2\u56fe\" alt=\"wordpress\u53bb\u9664index.php\u7684\u65b9\u6cd5\u63d2\u56fe\" \/><\/p>\n<p>\/&#8221; target=&#8221;_blank&#8221;&gt;<strong>wordpress<\/strong><strong>\u53bb\u6389index.php\u7684\u65b9\u6cd5<\/strong><\/p>\n<p>\u4e3b\u8981\u6709\u4e24\u4e2a\u6b65\u9aa4\uff1a<\/p>\n<p>1-1\uff09 wordpress\u8bbe\u7f6e\u56fa\u5b9a\u94fe\u63a5<\/p>\n<p>\u767b\u5f55wordpress\u540e\u53f0\uff0c<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u4f9d\u6b21\u9009\u62e9\u2018\u8bbe\u7f6e\/\u56fa\u5b9a\u94fe\u63a5\u2019<\/p>\n<p>\u5728\u51fa\u73b0\u7684\u9875\u9762\u4e2d\uff0c<\/p>\n<p>\u9009\u62e9\u2018\u81ea\u5b9a\u4e49\u7ed3\u6784\u2019<\/p>\n<p>\u7136\u540e\u6839\u636e\u4f60\u7684\u60c5\u51b5\uff0c<\/p>\n<p>\u8bbe\u7f6e\u597d\u94fe\u63a5\u3002<\/p>\n<p>1-2\uff09 \u8bbe\u7f6ewordpress\u91cd\u5199\u89c4\u5219<\/p>\n<p>\u8fd9\u4e2a\u9700\u8981\u6839\u636e\u4f60\u7684web\u670d\u52a1\u5668\u6765\u51b3\u5b9a<\/p>\n<p>1-2-1\uff09 wordpress apache\u9759\u6001\u94fe\u63a5\u91cd\u5199\u89c4\u5219<\/p>\n<p>\u5982\u679c\u4f60\u662f apache\uff0c<\/p>\n<p>\u5728 wordpress \u7f51\u7ad9\u76ee\u5f55\u4e0b\uff0c<\/p>\n<p>\u65b0\u5efa\u4e00\u4e2a .htaccess \u6587\u4ef6<\/p>\n<p>\u5e76\u5199\u5165\u4e0b\u9762\u7684\u4ee3\u7801<\/p>\n<pre>&lt;ifmodule&gt;\nRewriteEngine&nbsp;On\nRewriteBase&nbsp;\/wordpress\/\nRewriteRule&nbsp;^index.php$&nbsp;-&nbsp;[L]\nRewriteCond&nbsp;%{REQUEST_FILENAME}&nbsp;!-f\nRewriteCond&nbsp;%{REQUEST_FILENAME}&nbsp;!-d\nRewriteRule&nbsp;.&nbsp;\/wordpress\/index.php&nbsp;[L]\n&lt;\/ifmodule&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>1-2-2\uff09 wordpress nginx \u9759\u6001\u94fe\u63a5\u91cd\u5199\u89c4\u5219<\/p>\n<p>\u5982\u679c\u4f60\u7684web\u670d\u52a1\u5668\u662f nginx\uff0c<\/p>\n<p>\u7f16\u8f91 nginx \u7684\u914d\u7f6e\u6587\u4ef6 nginx.cnf<\/p>\n<p>\u5728 server {} \u914d\u7f6e\u5185\u5bb9\u4e2d\uff0c<\/p>\n<p>\u5199\u5165\u4e0b\u9762\u7684\u4ee3\u7801<\/p>\n<pre>location&nbsp;\/&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(-f&nbsp;$request_filename\/index.html){\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rewrite&nbsp;(.*)&nbsp;$1\/index.html&nbsp;break;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(-f&nbsp;$request_filename\/index.php){\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rewrite&nbsp;(.*)&nbsp;$1\/index.php;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!-f&nbsp;$request_filename){\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rewrite&nbsp;(.*)&nbsp;\/index.php;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\u91cd\u542f nginx<\/p>\n<p>\u8fd9\u6837\u5c31\u80fd\u628a wordpress \u94fe\u63a5\u4e2d\u7684 index.php \u53bb\u6389\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u53bb\u9664index.php\u7684\u65b9\u6cd5\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>wordpress\u53bb\u9664index.php\u7684\u65b9\u6cd5\uff1a\u9996\u5148\u767b\u5f55wordpress\u540e\u53f0\uff1b\u7136\u540e\u4f9d\u6b21\u9009\u62e9\u201c\u8bbe\u7f6e-\u56fa\u5b9a\u94fe\u63a5\u201d\u5e76\u8bbe\u7f6e\u597d\u94fe\u63a5\uff1b\u63a5\u7740\u8bbe\u7f6ewordpress\u91cd\u5199\u89c4\u5219\uff1b\u6700\u540e\u5728wordpress\u7f51\u7ad9\u76ee\u5f55\u4e0b\u65b0\u5efahtaccess\u6587\u4ef6\u5373\u53ef\u3002 \/&#8221; target=&#8221;_blank&#8221;&gt;wordpress\u53bb\u6389index.php\u7684\u65b9\u6cd5 \u4e3b\u8981\u6709\u4e24\u4e2a\u6b65\u9aa4\uff1a 1-1\uff09 wordpress\u8bbe\u7f6e\u56fa\u5b9a\u94fe\u63a5 \u767b\u5f55wordpress\u540e\u53f0\uff0c \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u4f9d\u6b21\u9009\u62e9\u2018\u8bbe\u7f6e\/\u56fa\u5b9a\u94fe\u63a5\u2019 \u5728\u51fa\u73b0\u7684\u9875\u9762\u4e2d\uff0c \u9009\u62e9\u2018\u81ea\u5b9a\u4e49\u7ed3\u6784\u2019 \u7136\u540e\u6839\u636e\u4f60\u7684\u60c5\u51b5\uff0c \u8bbe\u7f6e\u597d\u94fe\u63a5\u3002 1-2\uff09 \u8bbe\u7f6ewordpress\u91cd\u5199\u89c4\u5219 \u8fd9\u4e2a\u9700\u8981\u6839\u636e\u4f60\u7684web\u670d\u52a1\u5668\u6765\u51b3\u5b9a 1-2-1\uff09 wordpress apache\u9759\u6001\u94fe\u63a5\u91cd\u5199\u89c4\u5219 \u5982\u679c\u4f60\u662f apache\uff0c \u5728 wordpress \u7f51\u7ad9\u76ee\u5f55\u4e0b\uff0c \u65b0\u5efa\u4e00\u4e2a .htaccess \u6587\u4ef6 \u5e76\u5199\u5165\u4e0b\u9762\u7684\u4ee3\u7801 &lt;ifmodule&gt; RewriteEngine&nbsp;On RewriteBase&nbsp;\/wordpress\/ RewriteRule&nbsp;^index.php$&nbsp;&#8211;&nbsp;[L] RewriteCond&nbsp;%{REQUEST_FILENAME}&nbsp;!-f RewriteCond&nbsp;%{REQUEST_FILENAME}&nbsp;!-d RewriteRule&nbsp;.&nbsp;\/wordpress\/index.php&nbsp;[L] &lt;\/ifmodule&gt; \u767b\u5f55\u540e\u590d\u5236 1-2-2\uff09 wordpress nginx \u9759\u6001\u94fe\u63a5\u91cd\u5199\u89c4\u5219 \u5982\u679c\u4f60\u7684web\u670d\u52a1\u5668\u662f nginx\uff0c \u7f16\u8f91 nginx \u7684\u914d\u7f6e\u6587\u4ef6 nginx.cnf \u5728 server {} \u914d\u7f6e\u5185\u5bb9\u4e2d\uff0c \u5199\u5165\u4e0b\u9762\u7684\u4ee3\u7801 location&nbsp;\/&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(-f&nbsp;$request_filename\/index.html){ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rewrite&nbsp;(.*)&nbsp;$1\/index.html&nbsp;break; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-31794","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31794","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=31794"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31794\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}