{"id":94,"date":"2019-04-11T13:23:57","date_gmt":"2019-04-11T05:23:57","guid":{"rendered":"http:\/\/www.baishitou.cn\/?p=94"},"modified":"2019-04-12T11:35:29","modified_gmt":"2019-04-12T03:35:29","slug":"wordpress%e5%a6%82%e4%bd%95%e4%bc%aa%e9%9d%99%e6%80%81%e8%ae%be%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/www.baishitou.cn\/94.html","title":{"rendered":"wordpress\u4f2a\u9759\u6001\u8bbe\u7f6e"},"content":{"rendered":"

\u8bbe\u7f6e\u6210\u529f\u7684\u524d\u63d0\u662f\u4f60\u7684\u7a7a\u95f4\u5fc5\u987b\u652f\u6301\u4f2a\u9759\u6001\u3002<\/p>\n

\u521a\u5b89\u88c5\u7684WordPress\u7684\u6240\u6709\u7f51\u9875\uff0c\u90fd\u5e26\u201c\u95ee\u53f7\u201d\u7684PHP\u52a8\u6001\u94fe\u63a5\uff0c\u867d\u7136\u641c\u7d22\u5f15\u64ce\u4e0d\u62b5\u89e6\u52a8\u6001\u9875\u9762\uff0c\u4f46\u662f\u9759\u6001\u9875\u9762\u4f9d\u7136\u662f\u73b0\u5728\u7f51\u7ad9\u7684\u4e3b\u6d41\u3002<\/p>\n

WordPress\u7531\u4e8e\u662fPHP\u7cfb\u7edf\uff0c\u6240\u4ee5\u4e0d\u80fd\u5b8c\u7f8e\u9759\u6001\u5316\uff0c\u53ea\u53ef\u4ee5\u5b9e\u73b0\u4f2a\u9759\u6001\u5316\uff0c\uff0c\u5e76\u4e14\u53ea\u9488\u5bf9\u6587\u7ae0\uff0c\u5176\u5b83\u9875\u9762\u3001\u5b58\u6863\u3001\u65e5\u671f\u7684\u9875\u9762\u4e0d\u53ef\u4ee5\u4f2a\u9759\u6001\u5316\u3002<\/p>\n

\u4f2a\u9759\u6001\u5316\u540e\u66f4\u5bb9\u6613\u88ab\u5404\u5927\u641c\u7d22\u5f15\u64ce\u6536\u5f55\u3001\u589e\u52a0\u6743\u91cd\uff0c\u53e6\u5916\uff0c\u62fc\u97f3\u6216\u82f1\u6587\u7684\u540e\u7f00\u8fd8\u80fd\u589e\u5f3a\u7f51\u7ad9\u8bbf\u95ee\u4f53\u9a8c\u3002\u4fee\u6539\u6b65\u9aa4\uff1a\u767b\u5f55\u7f51\u7ad9\u540e\u53f0\u2192\u8bbe\u7f6e\u2192\u56fa\u5b9a\u94fe\u63a5\u2192\u81ea\u5b9a\u4e49\u7ed3\u6784\uff0c\u8f93\u5165\u5c55\u793a\u4ee3\u7801\uff0c\u53ef\u4ee5\u663e\u793a\u4e0d\u540c\u7684\u94fe\u63a5\uff0c\u5c55\u793a\u65b9\u5f0f\u53ef\u4ee5\u81ea\u5df1\u9009\u62e9\u3002<\/p>\n

\u9996\u5148\u5728WordPress\u540e\u53f0-\u8bbe\u7f6e-\u56fa\u5b9a\u94fe\u63a5-\u81ea\u5b9a\u4e49\u7ed3\u6784\u91cc\u9762\u8f93\u5165\/%post_id%.html \u7136\u540e\u4fdd\u5b58<\/p>\n

\"\"<\/a><\/p>\n

\u4e00\u3001\u81ea\u5b9a\u4e49WordPress\u94fe\u63a5\u540e\u7f00<\/strong><\/p>\n

1\u3001\u5148\u4e86\u89e3\u56fa\u5b9a\u94fe\u63a5\u5f62\u5f0f\u7684\u7ec4\u6210\uff0c\u8fd9\u4e9b\u4ee3\u7801\u53ef\u4ee5\u5355\u72ec\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u7ed3\u5408\u4f7f\u7528\uff0c\u76f4\u63a5\u590d\u5236\u5c0f\u62ec\u53f7\u524d\u7684\u4ee3\u7801\u5230\u81ea\u5b9a\u4e49\u56fa\u5b9a\u94fe\u63a5\u4e2d\u4fdd\u5b58\u5373\u53ef\u540e\u7f00\u53ef\u4ee5\u7531\u4e0b\u5217\u53c2\u6570\u7ec4\u5408\u3002<\/p>\n

%year%\u00a0\uff08\u5e74\u4efd\uff0c\u56db\u4f4d\u6570\u5b57\uff09\r\n\r\n%monthnum%\u00a0\uff08\u6708\u4efd\uff09\r\n\r\n%day%\u00a0\uff08\u5f53\u65e5\uff09\r\n\r\n%hour%\u00a0\uff08\u5c0f\u65f6\uff09\r\n\r\n%minute%\u00a0\uff08\u5206\u949f\uff09\r\n\r\n%second%\u00a0\uff08\u79d2\uff09\r\n\r\n%postname%\u00a0\uff08\u9875\u9762\u522b\u540d\uff09\r\n\r\n%post_id%\u00a0\uff08\u5e8f\u5217\u6570\u5b57\uff09\r\n\r\n%category%\u00a0\uff08\u5206\u7c7b\u522b\u540d\uff09\r\n\r\n%author%\u00a0\uff08\u4f5c\u8005\u540d\uff09<\/code><\/pre>\n

2\u3001\u76f8\u5bf9\u6765\u8bf4\uff0c\u767e\u5ea6\u66f4\u559c\u6b22html\u3001htm\u540e\u7f00\u7684\u9875\u9762\uff0c\u73b0\u5728IP\u8fc7\u4e07\u7684WordPress\u535a\u5ba2\u90fd\u4f7f\u7528\u4e86htm\u540e\u7f00\u7684\u4f2a\u9759\u6001\u5316\uff0c\u767e\u5ea6\u3001Google\u6743\u91cd\u90fd\u5230\u4e867\uff0c\u53ef\u89c1\u4fee\u6539\u56fa\u5b9a\u94fe\u63a5\u662f\u5f88\u6709\u5fc5\u8981\u7684\u3002<\/p>\n

\u81ea\u4eceGoogle\u6de1\u51fa\u4e2d\u56fd\u5e02\u573a\uff0c\u767e\u5ea6\u6210\u4e3a\u4e00\u5bb6\u72ec\u5927\uff0c\u65e0\u6570\u7684\u7f51\u7ad9\u57fa\u672c\u90fd\u662f\u9760\u767e\u5ea6\u5403\u996d\u7684\u3002\u56fd\u5185\u7684\u5404\u5927\u641c\u7d22\u5f15\u64ce\u90fd\u58f0\u660e\u53ef\u4ee5\u6b63\u5e38\u6536\u5f55\u52a8\u6001\u94fe\u63a5\uff0c\u4f46\u662f\u7531\u4e8e\u4e92\u8054\u7f51\u6700\u539f\u59cb\u7684\u7f51\u9875\u8bbe\u8ba1\u90fd\u662fhtml\u3001htm\uff0c\u5207\u641c\u7d22\u5f15\u64ce\u672c\u8eab\u7684\u7ad9\u70b9\u90fd\u662f\u9759\u6001\u9875\u9762\uff0c\u6240\u4ee5\u79cd\u79cd\u539f\u56e0\u4f7f\u5f97\u4f17\u591a\u7ad9\u957f\u628a\u7f51\u7ad9\u9759\u6001\u5316\u3002\u4ece\u4f18\u5316\u89d2\u5ea6\u6765\u8bf4\uff0c\/%postname%.html\u662f\u6700\u9002\u5408\u505a\u5173\u952e\u8bcd\u6392\u540d\u7684\u3002<\/p>\n

\/%postname%.html\r\n\r\n\/%postname%\/\r\n\r\n\/%post_id%.html<\/code><\/pre>\n

 <\/p>\n

3\u3001\u4e0d\u8fc7Google\u559c\u6b22\/%postname%\/\u7684\u9875\u9762\uff0c\/%postname%\/\u5728\u82f1\u6587\u535a\u5ba2\u4e2d\u975e\u5e38\u591a\u89c1\uff0c\u8fd9\u79cd\u56fa\u5b9a\u94fe\u63a5\u65b9\u5f0f\u662f\u6700\u5229\u4e8e\u4f18\u5316\u82f1\u6587\u5173\u952e\u8bcd\u7684\uff0c\u767e\u5ea6\u5bf9\u4e8e\u82f1\u6587\u8bcd\u7684\u540e\u7f00\u7ed9\u4e88\u5f88\u597d\u7684\u6392\u540d\u3002<\/p>\n

\/%year%\/%monthnum%\/%day%\/%postname%\/\uff08\u5e74\/\u6708\/\u65e5\/\u65e5\u5fd7\u540d\uff09\r\n\r\n\/%year%\/%monthnum%\/%postname%\/\uff08\u5e74\/\u6708\/\u65e5\u5fd7\u540d\uff09\r\n\r\n\/%monthnum%\/%day%\/%postname%\/\uff08\u6708\/\u65e5\/\u65e5\u5fd7\u540d\uff09\r\n\r\n\/%year%\/%monthnum%\/%day%\/%post_id%\/\uff08\u5e74\/\u6708\/\u65e5\/\u65e5\u5fd7id\u53f7\uff09\r\n\r\n\/%year%\/%monthnum%\/%post_id%\/\uff08\u5e74\/\u6708\/\u65e5\u5fd7id\u53f7\uff09\r\n\r\n\/%monthnum%\/%day%\/%post_id%\/\uff08\u6708\/\u65e5\/\u65e5\u5fd7id\u53f7\uff09\r\n\r\n\/archives\/%post_id%\uff08\/archives\/\u65e5\u5fd7id\u53f7\uff09\r\n\r\n\/archives\/%postname%\uff08\/archives\/\u65e5\u5fd7\u540d\uff09\r\n\r\n\/%post_id%\uff08\u65e5\u5fd7id\u53f7\uff09\r\n\r\n\/%postname%\uff08\u65e5\u5fd7\u540d\uff09<\/code><\/pre>\n

 <\/p>\n

\u4e8c\u3001\u865a\u62df\u4e3b\u673a\u4f2a\u9759\u6001\u89c4\u5219<\/strong><\/p>\n

\u4fee\u6539WordPress\u56fa\u5b9a\u94fe\u63a5\u4f2a\u9759\u6001\u5316\u540e\uff0c\u7f51\u9875\u5374\u6253\u4e0d\u5f00\uff0c\u51fa\u73b0\u8fd9\u79cd\u60c5\u51b5\u8fd9\u662f\u56e0\u4e3a\u7f3a\u5c11\u4f2a\u9759\u6001\u89c4\u5219\u3002<\/p>\n

WordPress\u56fa\u5b9a\u94fe\u63a5\u4f2a\u9759\u6001\u5316\u8bbe\u7f6e\u89c4\u5219\uff0c\u662f\u6839\u636e\u4f60\u4e3b\u673a\u73af\u5883\u6765\u51b3\u5b9a\u7684\uff0c\u4e0d\u9700\u8981\u63d2\u4ef6\uff0c\u7f51\u4e0a\u8fd0\u884c\u7684wordpress\u65e0\u975eIIS\/Apache\/Nginx\u8fd9\u4e09\u79cd\u73af\u5883\u3002<\/p>\n

WordPress\u56fa\u5b9a\u94fe\u63a5\u4f2a\u9759\u6001\u5316\u8bbe\u7f6e\u6280\u5de7\u591a\u79cd\u591a\u6837\uff0c\u9700\u8981\u5bf9\u53f7\u5165\u5ea7\u3002\u5982\u679c\u4f7f\u7528\u7684\u662f\u865a\u62df\u4e3b\u673a\uff0c\u5927\u591a\u6570\u7684IDC\u670d\u52a1\u5546\uff0c\u90fd\u652f\u6301wordpress\u4f2a\u9759\u6001\uff0c\u76f4\u63a5\u5728\u540e\u53f0\u4fee\u6539\u56fa\u5b9a\u94fe\u63a5\u8bbe\u7f6e\u5373\u53ef\u3002<\/p>\n

1\u3001Linux\u670d\u52a1\u5668\u73af\u5883<\/p>\n

\u8bf7\u786e\u4fdd\u4f60\u7684\u6839\u76ee\u5f55\u5f00\u542f\u4e86777\u6743\u9650\uff0c\u5df2\u5f00\u542f\u7684\u8bdd\uff0c\u5728\u4fee\u6539\u81ea\u5b9a\u4e49\u56fa\u5b9a\u94fe\u63a5\u540e\u7684\u77ac\u95f4\uff0c\u4f1a\u5728\u4e3b\u673a\u6839\u76ee\u5f55\u81ea\u52a8\u751f\u6210\u4e00\u4e2a.htaccess\u7684\u6587\u4ef6\uff0c\u6253\u5f00\u67e5\u770b\u662f\u5426\u5df2\u751f\u6210\u89c4\u5219\uff0c\u751f\u6210\u7684\u8bdd\uff0c\u5c31OK\u4e86\uff0c\u5c31\u4e0d\u9700\u8981\u5f80\u4e0b\u770b\u4e86\u3002<\/p>\n

\u5982\u679c\u6ca1\u6709\u751f\u6210.htaccess\uff0c\u6216\u8005.htaccess\u91cc\u6ca1\u6709\u5185\u5bb9\uff0c\u90a3\u5c31\u9700\u8981\u624b\u52a8\u521b\u5efa\u4e00\u4e2atxt\u6587\u4ef6\uff0c\u4f7f\u7528\u4e0a\u4f20\u8f6f\u4ef6\u4fee\u6539\u540d\u4e3a .htaccess\uff0c\u7c98\u8d34Apache\u6216Nginx\u89c4\u5219\u4ee3\u7801\uff0c\u4fdd\u5b58\u5e76\u4e0a\u4f20\u5230\u7f51\u7ad9\u6839\u76ee\u5f55\u5c31\u884c\u4e86\u3002<\/p>\n

Apache\u89c4\u5219<\/p>\n

<IfModule\u00a0mod_rewrite.c>\r\n\r\nRewriteEngine\u00a0On\r\n\r\nRewriteBase\u00a0\/\r\n\r\nRewriteRule\u00a0^index\\.php$\u00a0-\u00a0[L]\r\n\r\nRewriteCond\u00a0%{REQUEST_FILENAME}\u00a0!-f\r\n\r\nRewriteCond\u00a0%{REQUEST_FILENAME}\u00a0!-d\r\n\r\nRewriteRule\u00a0.\u00a0\/index.php\u00a0[L]\r\n\r\n<\/IfModule><\/code><\/pre>\n

 <\/p>\n

Nginx\u89c4\u5219<\/p>\n

location\u00a0\/\u00a0{\r\n\r\nif\u00a0(-f\u00a0$request_filename\/index.html){\r\n\r\nrewrite\u00a0(.*)\u00a0$1\/index.html\u00a0break;\r\n\r\n}\r\n\r\nif\u00a0(-f\u00a0$request_filename\/index.php){\r\n\r\nrewrite\u00a0(.*)\u00a0$1\/index.php;\r\n\r\n}\r\n\r\nif\u00a0(!-f\u00a0$request_filename){\r\n\r\nrewrite\u00a0(.*)\u00a0\/index.php;\r\n\r\n}\r\n\r\n}<\/code><\/pre>\n

2\u3001Windows\u4e3b\u673aIIS\u73af\u5883\u4e0b\u4f2a\u9759\u6001\u89c4\u5219<\/p>\n

\u4f60\u4f7f\u7528\u7684windows\u4e3b\u673a\u5fc5\u987b\u5b89\u88c5\u4e86\u88c5Rewrite \u7ec4\u4ef6\u624d\u80fd\u652f\u6301\u4f2a\u9759\u6001\uff0c\u54a8\u8be2\u4e0b\u4f60\u7684\u4e3b\u673a\u5546\u6240\u4f7f\u7528\u7684\u4e3b\u673a\u662f\u5426\u652f\u6301\u4f2a\u9759\u6001\uff0c\u652f\u6301\u7684\u8bdd\u8bf7\u7ee7\u7eed\u5f80\u4e0b\u770b\u3002<\/p>\n

\u5982\u679c\u4e3b\u673a\u652f\u6301\u4f2a\u9759\u6001\uff0c\u5728\u4fee\u6539wordpress\u56fa\u5b9a\u94fe\u63a5\u540e\u65e0\u6cd5\u4f2a\u9759\u6001\uff0c\u5728\u6839\u76ee\u5f55\u81ea\u52a8\u751f\u6210\u4e00\u4e2ahttpd.ini\uff0c\u6ca1\u6709\u751f\u6210\u7684\u8bdd\uff0c\u5c31\u521b\u5efa\u4e00\u4e2atxt\u6587\u672c\uff0c\u4fee\u6539\u540d\u5b57\u4e3ahttpd.ini\uff0c\u590d\u5236\u7c98\u8d34\u4e0b\u8fb9\u4ee3\u7801\uff0c\u4fdd\u5b58\u4e0a\u4f20\u5230\u6839\u76ee\u5f55\u3002<\/p>\n

[ISAPI_Rewrite]\r\n\r\n#\u00a0Defend\u00a0your\u00a0computer\u00a0from\u00a0some\u00a0worm\u00a0attacks\r\n\r\n#RewriteRule\u00a0.*(?:global.asa|default\\.ida|root\\.exe|\\.\\.).*\u00a0.\u00a0[F,I,O]\r\n\r\n#\u00a03600\u00a0=\u00a01\u00a0hour\r\n\r\nCacheClockRate\u00a03600\r\n\r\nRepeatLimit\u00a032\r\n\r\n#\u00a0Protect\u00a0httpd.ini\u00a0and\u00a0httpd.parse.errors\u00a0files\r\n\r\n#\u00a0from\u00a0accessing\u00a0through\u00a0HTTP\r\n\r\n#\u00a0Rules\u00a0to\u00a0ensure\u00a0that\u00a0normal\u00a0content\u00a0gets\u00a0through\r\n\r\nRewriteRule\u00a0\/tag\/(.*)\u00a0\/index\\.php\\?tag=$1\r\n\r\nRewriteRule\u00a0\/software-files\/(.*)\u00a0\/software-files\/$1\u00a0[L]\r\n\r\nRewriteRule\u00a0\/images\/(.*)\u00a0\/images\/$1\u00a0[L]\r\n\r\nRewriteRule\u00a0\/sitemap.xml\u00a0\/sitemap.xml\u00a0[L]\r\n\r\nRewriteRule\u00a0\/favicon.ico\u00a0\/favicon.ico\u00a0[L]\r\n\r\n#\u00a0For\u00a0file-based\u00a0wordpress\u00a0content\u00a0(i.e.\u00a0theme),\u00a0admin,\u00a0etc.\r\n\r\nRewriteRule\u00a0\/wp-(.*)\u00a0\/wp-$1\u00a0[L]\r\n\r\n#\u00a0For\u00a0normal\u00a0wordpress\u00a0content,\u00a0via\u00a0index.php\r\n\r\nRewriteRule\u00a0^\/$\u00a0\/index.php\u00a0[L]\r\n\r\nRewriteRule\u00a0\/(.*)\u00a0\/index.php\/$1\u00a0[L]<\/code><\/pre>\n

 <\/p>\n

PS\uff1a<\/p>\n

\u5982\u679c\u4f60\u4e0d\u77e5\u9053\u6240\u4f7f\u7528\u7684\u4e3b\u673a\u662f\u4ec0\u4e48\u7cfb\u7edf\uff0c\u6216\u4f7f\u7528\u7684Linux\u6216Windows\u7cfb\u7edf\u7684VPS\u4e3b\u673a\uff0c\u4e0d\u4f1a\u914d\u7f6e\u4f2a\u9759\u6001\u89c4\u5219\uff0c\u53ef\u4ee5\u54a8\u8be2\u4f60\u7684\u7a7a\u95f4\u5546\uff0c\u4ed6\u4eec\u4f1a\u5e2e\u52a9\u4f60\u5b9e\u73b0wordpress\u4f2a\u9759\u6001\uff0c\u867d\u7136\u8bbe\u7f6e\u4e86\u4f2a\u9759\u6001\uff0c\u53ea\u662f\u5c55\u793a\u7684\u4f2a\u9759\u6001\u540e\u7f00\uff0c\u5176\u5b9e\u8fd8\u662f\u52a8\u6001\u9875\u9762\uff0c\u5982\u679c\u60f3\u5b8c\u5168\u9759\u6001\u9875\u9762\uff0c\u53ef\u4ee5\u5b89\u88c5WP Super Cache\u6216\u8005Hyper Cache\u63d2\u4ef6\uff0c\u4e3a\u5168\u7ad9\u751f\u6210\u9759\u6001\u9875\u9762\u7f13\u5b58\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u8bbe\u7f6e\u6210\u529f\u7684\u524d\u63d0\u662f\u4f60\u7684\u7a7a\u95f4\u5fc5\u987b\u652f\u6301\u4f2a\u9759\u6001\u3002 \u521a\u5b89\u88c5\u7684WordPress\u7684\u6240\u6709\u7f51\u9875\uff0c\u90fd\u5e26\u201c\u95ee\u53f7\u201d\u7684PHP\u52a8\u6001\u94fe\u63a5\uff0c […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[5,358],"class_list":["post-94","post","type-post","status-publish","format-standard","hentry","category-web","tag-wordpress","tag-358"],"_links":{"self":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/94","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/comments?post=94"}],"version-history":[{"count":0,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/94\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/media?parent=94"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/categories?post=94"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/tags?post=94"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}