{"id":34366,"date":"2024-11-25T10:44:20","date_gmt":"2024-11-25T02:44:20","guid":{"rendered":"https:\/\/fwq.ai\/blog\/34366\/"},"modified":"2024-11-25T10:44:20","modified_gmt":"2024-11-25T02:44:20","slug":"wordpress%e6%80%8e%e4%b9%88%e6%94%b9%e5%90%8e%e5%8f%b0%e8%b7%af%e5%be%84","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/34366\/","title":{"rendered":"wordpress\u600e\u4e48\u6539\u540e\u53f0\u8def\u5f84"},"content":{"rendered":"<blockquote><p>\n  \u66f4\u6539 wordpress \u540e\u53f0\u8def\u5f84\u589e\u5f3a\u5b89\u5168\u6027\uff0c\u6b65\u9aa4\u5982\u4e0b\uff1a\u521b\u5efa .htaccess \u6587\u4ef6\uff0c\u6dfb\u52a0\u91cd\u5199\u89c4\u5219\u5c06\u540e\u53f0\u8def\u5f84\u66f4\u6539\u4e3a\u81ea\u5b9a\u4e49\u8def\u5f84\uff0c\u5982 \/my-admin-path\uff1b\u66f4\u65b0 wp-config.php\uff0c\u5b9a\u4e49\u65b0\u7684\u540e\u53f0\u8def\u5f84\uff1b\u6e05\u9664\u7f13\u5b58\uff0c\u786e\u4fdd\u65b0\u8def\u5f84\u751f\u6548\uff1b\u6d4b\u8bd5\u65b0\u8def\u5f84\uff0c\u8f93\u5165\u6d4f\u89c8\u5668\u5730\u5740\u680f\u4e2d\u7684\u81ea\u5b9a\u4e49\u8def\u5f84\u5373\u53ef\u8bbf\u95ee\u540e\u53f0\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/05\/2024060501272054501.jpg\" class=\"aligncenter\" title=\"wordpress\u600e\u4e48\u6539\u540e\u53f0\u8def\u5f84\u63d2\u56fe\" alt=\"wordpress\u600e\u4e48\u6539\u540e\u53f0\u8def\u5f84\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u66f4\u6539 WordPress \u540e\u53f0\u8def\u5f84<\/strong><\/p>\n<p>\u66f4\u6539 WordPress \u540e\u53f0\u8def\u5f84\u53ef\u4ee5\u63d0\u9ad8\u7f51\u7ad9\u5b89\u5168\u6027\uff0c\u9632\u6b62\u6076\u610f\u7528\u6237\u731c\u6d4b\u9ed8\u8ba4\u540e\u53f0\u8def\u5f84\u5e76\u8bbf\u95ee\u7ba1\u7406\u9875\u9762\u3002\u4ee5\u4e0b\u662f\u66f4\u6539\u540e\u53f0\u8def\u5f84\u7684\u6b65\u9aa4\uff1a<\/p>\n<p><strong>\u521b\u5efa .ht \u6587\u4ef6<\/strong><\/p>\n<ol>\n<li>\u4f7f\u7528 FTP \u6216\u6587\u4ef6\u7ba1\u7406\u5de5\u5177\u8fde\u63a5\u5230 WordPress \u7f51\u7ad9\u7684\u4e3b\u673a\u7a7a\u95f4\u3002<\/li>\n<li>\u5728 WordPress \u6839\u76ee\u5f55\u4e0b\u521b\u5efa\u65b0\u7684 .htaccess \u6587\u4ef6\u3002<\/li>\n<li>\u6253\u5f00 .htaccess \u6587\u4ef6\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/li>\n<\/ol>\n<pre>RewriteEngine On\nRewriteRule ^wp-admin\/(.*)$ \/custom-admin-path\/$1 [R=301,L]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5c06 &#8220;custom-admin-path&#8221; \u66ff\u6362\u4e3a\u65b0\u8def\u5f84<\/strong><\/p>\n<p><strong>\u4f8b\u5982\uff1a<\/strong>\u82e5\u8981\u5c06\u540e\u53f0\u8def\u5f84\u66f4\u6539\u4e3a &#8220;\/my-admin-path&#8221;\uff0c\u5c06\u4ee3\u7801\u66ff\u6362\u4e3a\uff1a<\/p>\n<pre>RewriteRule ^wp-admin\/(.*)$ \/my-admin-path\/$1 [R=301,L]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4fdd\u5b58\u5e76\u4e0a\u4f20 .htaccess \u6587\u4ef6<\/strong><\/p>\n<ol>\n<li>\u4fdd\u5b58 .htaccess \u6587\u4ef6\u5e76\u5c06\u5176\u4e0a\u4f20\u56de\u670d\u52a1\u5668\u3002<\/li>\n<\/ol>\n<p><strong>\u66f4\u65b0 wp-config.php<\/strong><\/p>\n<ol>\n<li>\u6253\u5f00 wp-config.php \u6587\u4ef6\u3002<\/li>\n<li>\u5728\u4ee5\u4e0b\u4ee3\u7801\u4e0b\u65b9\u6dfb\u52a0\u65b0\u884c\uff1a<\/li>\n<\/ol>\n<pre>define('ADMIN_COOKIE_PATH', '\/custom-admin-path');<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4fdd\u5b58\u5e76\u4e0a\u4f20 wp-config.php \u6587\u4ef6<\/strong><\/p>\n<ol>\n<li>\u4fdd\u5b58 wp-config.php \u6587\u4ef6\u5e76\u5c06\u5176\u4e0a\u4f20\u56de\u670d\u52a1\u5668\u3002<\/li>\n<\/ol>\n<p><strong>\u6e05\u9664\u7f13\u5b58<\/strong><\/p>\n<p>\u6e05\u9664 WordPress \u7f13\u5b58\u53ef\u4ee5\u786e\u4fdd\u65b0\u8def\u5f84\u751f\u6548\u3002\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u4e4b\u4e00\u8fdb\u884c\u6e05\u9664\uff1a<\/p>\n<ul>\n<li>\u4f7f\u7528\u7f13\u5b58\u63d2\u4ef6<\/li>\n<li>\u624b\u52a8\u5220\u9664\u6d4f\u89c8\u5668\u7f13\u5b58<\/li>\n<li>\u4ece WordPress \u4eea\u8868\u76d8\u4e2d\u6ce8\u9500\u5e76\u91cd\u65b0\u767b\u5f55<\/li>\n<\/ul>\n<p><strong>\u6d4b\u8bd5\u65b0\u8def\u5f84<\/strong><\/p>\n<p>\u5728\u6d4f\u89c8\u5668\u5730\u5740\u680f\u4e2d\u8f93\u5165\u65b0\u7684\u540e\u53f0\u8def\u5f84\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre>https:\/\/example.com\/my-admin-path\/<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u4e00\u5207\u8bbe\u7f6e\u6b63\u786e\uff0c\u60a8\u5c06\u88ab\u91cd\u5b9a\u5411\u5230\u65b0\u7684\u540e\u53f0\u767b\u5f55\u9875\u9762\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u6539\u540e\u53f0\u8def\u5f84\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>\u66f4\u6539 wordpress \u540e\u53f0\u8def\u5f84\u589e\u5f3a\u5b89\u5168\u6027\uff0c\u6b65\u9aa4\u5982\u4e0b\uff1a\u521b\u5efa .htaccess \u6587\u4ef6\uff0c\u6dfb\u52a0\u91cd\u5199\u89c4\u5219\u5c06\u540e\u53f0\u8def\u5f84\u66f4\u6539\u4e3a\u81ea\u5b9a\u4e49\u8def\u5f84\uff0c\u5982 \/my-admin-path\uff1b\u66f4\u65b0 wp-config.php\uff0c\u5b9a\u4e49\u65b0\u7684\u540e\u53f0\u8def\u5f84\uff1b\u6e05\u9664\u7f13\u5b58\uff0c\u786e\u4fdd\u65b0\u8def\u5f84\u751f\u6548\uff1b\u6d4b\u8bd5\u65b0\u8def\u5f84\uff0c\u8f93\u5165\u6d4f\u89c8\u5668\u5730\u5740\u680f\u4e2d\u7684\u81ea\u5b9a\u4e49\u8def\u5f84\u5373\u53ef\u8bbf\u95ee\u540e\u53f0\u3002 \u5982\u4f55\u66f4\u6539 WordPress \u540e\u53f0\u8def\u5f84 \u66f4\u6539 WordPress \u540e\u53f0\u8def\u5f84\u53ef\u4ee5\u63d0\u9ad8\u7f51\u7ad9\u5b89\u5168\u6027\uff0c\u9632\u6b62\u6076\u610f\u7528\u6237\u731c\u6d4b\u9ed8\u8ba4\u540e\u53f0\u8def\u5f84\u5e76\u8bbf\u95ee\u7ba1\u7406\u9875\u9762\u3002\u4ee5\u4e0b\u662f\u66f4\u6539\u540e\u53f0\u8def\u5f84\u7684\u6b65\u9aa4\uff1a \u521b\u5efa .ht \u6587\u4ef6 \u4f7f\u7528 FTP \u6216\u6587\u4ef6\u7ba1\u7406\u5de5\u5177\u8fde\u63a5\u5230 WordPress \u7f51\u7ad9\u7684\u4e3b\u673a\u7a7a\u95f4\u3002 \u5728 WordPress \u6839\u76ee\u5f55\u4e0b\u521b\u5efa\u65b0\u7684 .htaccess \u6587\u4ef6\u3002 \u6253\u5f00 .htaccess \u6587\u4ef6\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a RewriteEngine On RewriteRule ^wp-admin\/(.*)$ \/custom-admin-path\/$1 [R=301,L] \u767b\u5f55\u540e\u590d\u5236 \u5c06 &#8220;custom-admin-path&#8221; \u66ff\u6362\u4e3a\u65b0\u8def\u5f84 \u4f8b\u5982\uff1a\u82e5\u8981\u5c06\u540e\u53f0\u8def\u5f84\u66f4\u6539\u4e3a &#8220;\/my-admin-path&#8221;\uff0c\u5c06\u4ee3\u7801\u66ff\u6362\u4e3a\uff1a RewriteRule ^wp-admin\/(.*)$ \/my-admin-path\/$1 [R=301,L] \u767b\u5f55\u540e\u590d\u5236 \u4fdd\u5b58\u5e76\u4e0a\u4f20 .htaccess \u6587\u4ef6 \u4fdd\u5b58 .htaccess \u6587\u4ef6\u5e76\u5c06\u5176\u4e0a\u4f20\u56de\u670d\u52a1\u5668\u3002 \u66f4\u65b0 wp-config.php \u6253\u5f00 [&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-34366","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/34366","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=34366"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/34366\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=34366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=34366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=34366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}