{"id":965,"date":"2016-05-09T10:02:24","date_gmt":"2016-05-09T02:02:24","guid":{"rendered":"https:\/\/www.ldhost.cn\/jc\/?p=965"},"modified":"2017-10-13T11:19:19","modified_gmt":"2017-10-13T03:19:19","slug":"htaccess%e7%9a%84%e4%bd%bf%e7%94%a8%e6%8a%80%e5%b7%a7","status":"publish","type":"post","link":"https:\/\/www.ldhost.cn\/jc\/ot\/965.html","title":{"rendered":".htaccess\u7684\u4f7f\u7528\u6280\u5de7"},"content":{"rendered":"<p>\u6709\u4e9b\u7528\u6237\u53ef\u80fd\u8fd8\u4e0d\u77e5\u9053.htaccess\u6587\u4ef6\u662f\u4ec0\u4e48\uff0c\u6240\u4ee5\u6211\u4eec\u9996\u5148\u6765\u8bf4\u660e\u4e00\u4e0b.htaccess\u7684\u4f5c\u7528\u3002\u5728<a href=\"https:\/\/www.ldhost.cn\/\" target=\"_blank\" rel=\"noopener\">\u4e50\u9053\u4e3b\u673a<\/a>\u7684public_html\u6839\u76ee\u5f55\u4e0b\uff0c\u4f60\u4f1a\u770b\u5230\u4e00\u4e2a\u540d\u4e3a.htaccess\u7684\u6587\u4ef6\uff0c\u5b83\u53ef\u4ee5\u662f\u7531\u7cfb\u7edf\u521b\u5efa\u3001\u4e5f\u53ef\u4ee5\u662f\u7528\u6237\u81ea\u5df1\u7f16\u8f91\u800c\u6210\u7684\u3002\u5b83\u662fApache\u670d\u52a1\u5668\u4e2d\u7684\u4e00\u4e2a\u914d\u7f6e\u6587\u4ef6\uff0c\u5b83\u8d1f\u8d23\u76f8\u5173\u76ee\u5f55\u4e0b\u7684\u7f51\u9875\u914d\u7f6e\uff0c\u5bf9\u7f51\u7ad9\u4e2d\u5b9e\u73b0\u6c38\u4e45\u94fe\u63a5(Permalink)\u81f3\u5173\u91cd\u8981\u3002\u540c\u65f6\u5229\u7528\u5b83\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u5b9e\u73b0\uff1a\u7f51\u9875301\u91cd\u5b9a\u5411\u3001\u81ea\u5b9a\u4e49404\u9519\u8bef\u9875\u9762\u3001\u6539\u53d8\u6587\u4ef6\u6269\u5c55\u540d\u3001\u5141\u8bb8\/\u963b\u6b62\u7279\u5b9a\u7684\u7528\u6237\u6216\u8005\u76ee\u5f55\u7684\u8bbf\u95ee\u3001\u7981\u6b62\u76ee\u5f55\u5217\u8868\u3001\u914d\u7f6e\u9ed8\u8ba4\u6587\u6863\u7b49\u529f\u80fd\u3002\u4e0b\u9762\u6211\u4eec\u5c31\u6765\u770b\u770b\u5982\u4f55\u914d\u5236.htaccess\u3002<\/p>\n<p>\u4ee5\u4e0b\u662fWordpress\u4e2d\u9ed8\u8ba4\u7684.htaccess\u5185\u5bb9\u3002\u6211\u4eec\u4e00\u4e00\u6765\u770b\u4e00\u4e0b\u6bcf\u4e00\u884c\u7684\u4f5c\u7528\u3002<br \/>\n<code>&lt;IfModule mod_rewrite.c&gt;<br \/>\nRewriteEngine On<br \/>\nRewriteBase \/<br \/>\nRewriteRule ^index\\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f<br \/>\nRewriteCond %{REQUEST_FILENAME} !-d<br \/>\nRewriteRule . \/index.php [L] &lt;\/IfModule&gt;<\/code><br \/>\n\u7b2c\u4e00\u884c\u7528\u6765\u5224\u65adApache\u4e2d\u662f\u5426\u5b89\u88c5\u4e86rewrite\u6a21\u5757\u3002\u5982\u679c\u5b58\u5728rewrite\u6a21\u5757\uff0c\u201cRewriteEngine On\u201d \u5219\u7528\u6765\u5f00\u542frewrite\u6a21\u5757\u3002<\/p>\n<p>\u201cRewriteBase \/\u201d \u7528\u6765\u8868\u793aApache\u8981\u5bf9URL\u91cd\u5199\u7684\u90e8\u5206\u3002\u6bd4\u65b9\u7ad9\u70b9\u4e3ahttp:\/\/domain.com\/\u3002RewriteBase\u540e\u9762\u4e3a\u201c\/\u201d\u65f6\uff0c\u8868\u793a\u5bf9\u4e3b\u57df\u540d\u4e0b\u9762\u7684\u6240\u6709\u5b50\u8def\u5f84\u8fdb\u884c\u91cd\u5199\uff0c\u5982\u679c\u662f\u201c\/blog\/\u201d \u662f\u53ea\u4f1a\u5bf9http:\/\/domain.com\/blog\/\u540e\u9762\u7684\u90e8\u5206\u8fdb\u884c\u91cd\u5199\u3002<\/p>\n<p>RewriteCond\u8868\u793a\u91cd\u5199URL\u5e94\u6ee1\u8db3\u7684\u4e00\u4e9b\u6761\u4ef6\uff0cRewriteRule \u540e\u9762\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u8868\u793a\u8981\u91cd\u5199\u7684URL\u6ee1\u8db3\u7684\u89c4\u5219\uff08\u6b63\u5219\u8868\u8fbe\u5f0f\uff09\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u8868\u793a\u91cd\u5199\u540e\u7684URL\u3002\u6700\u540e\u7684\u90a3\u4e2a[L]\u8868\u793a\u8868\u660e\u5f53\u524d\u89c4\u5219\u662f\u6700\u540e\u4e00\u6761\u89c4\u5219\uff0c\u505c\u6b62\u5206\u6790\u4ee5\u540e\u89c4\u5219\u7684\u91cd\u5199\u3002\uff08\u65b9\u6846\u5185\u8fd8\u53ef\u4ee5\u652f\u6301\u5f88\u591a\u5176\u5b83\u53c2\u6570\uff0c\u6211\u4eec\u4f1a\u5728\u4e0b\u9762\u4ecb\u7ecd)<\/p>\n<p>\u6240\u4ee5\u201cRewriteRule ^index\\.php$ \u2013 [L]\u201d\u8868\u793a\u82e5\u5f53\u524d\u8bf7\u6c42\u7684URL\u6070\u597d\u4e3aindex.php\uff0c\u5219\u4e0d\u8981\u8fdb\u884c\u540e\u9762\u7684\u5224\u65ad\u4e86\u3002<\/p>\n<p>\u201cRewriteCond %{REQUEST_FILENAME} !-f\u201d\u548c\u201cRewriteCond %{REQUEST_FILENAME} !-d\u201d\u8868\u793a\u5f53\u524d\u7684URL\u5e76\u4e0d\u662f\u4e00\u4e2a\u6587\u4ef6(-f)\u6216\u76ee\u5f55(-d)\u3002\u5f53\u8fd9\u4e24\u4e2a\u6761\u4ef6\u540c\u65f6\u6ee1\u8db3\u65f6\uff0c\u6700\u540e\u4e00\u6761\u201cRewriteRule . \/index.php [L]\u201d\u4f1a\u628a\u6240\u6709\u8bf7\u6c42\u90fd\u91cd\u5199\u4e3aindex.php\u3002<\/p>\n<p>\u4ece\u8fd9\u91cc\u6211\u4eec\u53ef\u4ee5\u770b\u51fa\uff0cwordpress\u9ed8\u8ba4\u628a\u6240\u6709\u4e0d\u6307\u5230\u9759\u6001\u6587\u4ef6\u6216\u76ee\u5f55\u7684url\u5168\u90e8\u91cd\u5199\u5230\u4e86index.php\uff0c\u7136\u540e\u7531index.php\u7edf\u4e00\u5904\u7406\u8bf7\u6c42\u3002<\/p>\n<p>\u521a\u624d\u6211\u4eec\u63d0\u5230\u4e86[L]\u7684\u4f5c\u7528\uff0c\u5176\u5b9eRewriteRule\u8fd8\u652f\u6301\u5f88\u591a\u5176\u5b83\u53c2\u6570\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>R \u5f3a\u5236\u5916\u90e8\u91cd\u5b9a\u5411\uff0c\u540e\u9762\u53ef\u4ee5\u4ee3301\u6216302\u8df3\u8f6c\u3002<\/li>\n<li>F \u7981\u7528URL,\u8fd4\u56de403HTTP\u72b6\u6001\u7801\u3002<\/li>\n<li>G \u5f3a\u5236URL\u4e3aGONE\uff0c\u8fd4\u56de410HTTP\u72b6\u6001\u7801\u3002<\/li>\n<li>P \u5f3a\u5236\u4f7f\u7528\u4ee3\u7406\u8f6c\u53d1\u3002<\/li>\n<li>L \u8868\u660e\u5f53\u524d\u89c4\u5219\u662f\u6700\u540e\u4e00\u6761\u89c4\u5219\uff0c\u505c\u6b62\u5206\u6790\u4ee5\u540e\u89c4\u5219\u7684\u91cd\u5199\u3002<\/li>\n<li>N \u91cd\u65b0\u4ece\u7b2c\u4e00\u6761\u89c4\u5219\u5f00\u59cb\u8fd0\u884c\u91cd\u5199\u8fc7\u7a0b\u3002<\/li>\n<li>C \u4e0e\u4e0b\u4e00\u6761\u89c4\u5219\u5173\u8054\u3002<\/li>\n<li>T=MIME-type(force MIME type) \u5f3a\u5236MIME\u7c7b\u578b\u3002<\/li>\n<li>NS \u53ea\u7528\u4e8e\u4e0d\u662f\u5185\u90e8\u5b50\u8bf7\u6c42\u3002<\/li>\n<li>NC \u4e0d\u533a\u5206\u5927\u5c0f\u5199\u3002<\/li>\n<li>QSA \u8ffd\u52a0\u8bf7\u6c42\u5b57\u7b26\u4e32\u3002<\/li>\n<li>NE \u4e0d\u5728\u8f93\u51fa\u8f6c\u4e49\u7279\u6b8a\u5b57\u7b26\u3002<\/li>\n<\/ul>\n<h2>.htaccess\u5728Wordpress\u4e2d\u7684\u4e00\u4e9b\u4f7f\u7528\u6280\u5de7<\/h2>\n<p>\u4e0a\u9762\u8bb2\u4e86\u4e00\u4e0bWordpress\u4e2d.httaccess\u7684\u57fa\u672c\u7528\u9014\uff0c\u5176\u5b9e\u5229\u7528.htaccess\u6587\u4ef6\u8fd8\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b8c\u6210\u5f88\u591a\u5176\u5b83\u7684\u5de5\u4f5c\u3002\u4e0b\u9762\u6211\u6765\u4ecb\u7ecd\u5176\u4e2d\u4e00\u4e9b\u5e38\u7528\u7684\u529f\u80fd\uff0c\u66f4\u591a\u7684\u8bfb\u8005\u53ef\u4ee5\u81ea\u5df1\u53bb\u5c1d\u8bd5\u3002<\/p>\n<h3>\u57df\u540d\u8df3\u8f6c<\/h3>\n<p>\u6709\u4e9b\u65f6\u5019\uff0c\u6211\u4eec\u4f1a\u60f3\u628adomain.com\u7684\u57df\u540d\u5168\u90e8\u8df3\u8f6c\u5230www.domain.com\u4e0b\u3002\u8fd9\u4e2a\u65f6\u5019htaccess\u5c31\u53ef\u4ee5\u6d3e\u4e0a\u7528\u573a\u4e86\u3002\u5728.htaccess\u6587\u4ef6\u4e2d\u6dfb\u52a0\u7c7b\u4f3c\u4e0b\u9762\u7684\u4ee3\u7801\uff1a\uff08\u4e0b\u9762\u8fd9\u6bb5\u4ee3\u7801\u5728\u7f51\u7ad9\u66f4\u6362\u57df\u540d\u65f6\uff0c\u4e5f\u540c\u6837\u4f7f\u7528\uff09<br \/>\n<code>RewriteCond %{HTTP_HOST} ^domain\\.com [NC] RewriteRule ^(.*)$ http:\/\/www.domain.com\/$1 [L,R=301]<\/code><br \/>\n\u7c7b\u4f3c\u7684\u8fd8\u53ef\u4ee5\u7528.htacess\u4e5f\u53ef\u4ee5\u7528\u6765\u66f4\u6362URL\u7684\u76ee\u5f55\u7ed3\u6784\uff0c\u8fd9\u4e2a\u5728Category\u540d\u5b57\u88ab\u66f4\u6362\u65f6\u7279\u522b\u6709\u7528\uff1a<br \/>\n<code>RewriteRule ^\/?old_directory\/([a-z\/.]+)$ new_directory\/$1 [R=301,L]<\/code><br \/>\n\u6ce8\uff1aR\u540e\u9762\u7684<a href=\"https:\/\/www.ldhost.cn\/jc\/do\/243.html\" target=\"_blank\" rel=\"noopener\">301<\/a>\u8868\u793a\u6b64\u8df3\u8f6c\u4e3a\u6c38\u4e45\u8df3\u8f6c\uff0c\u4e5f\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u8be5\u6210\u4e34\u65f6\u8df3\u8f6c\uff08302\uff09\u3002<\/p>\n<h3>\u9632\u76d7\u94fe<\/h3>\n<p>\u56fe\u7247\u7684<a href=\"https:\/\/www.ldhost.cn\/jc\/ot\/578.html\" target=\"_blank\" rel=\"noopener\">\u76d7\u94fe<\/a>\u53ef\u80fd\u662f\u5f88\u591a\u7ad9\u957f\u6700\u4e3a\u5934\u75db\u7684\u4e8b\u60c5\uff0c\u81ea\u5df1\u7684\u56fe\u7247\u88ab\u4eba\u767d\u767d\u62ff\u53bb\u4e0d\u8bf4\uff0c\u8fd8\u4f1a\u514d\u8d39\u5360\u7528\u4e86\u81ea\u5df1\u7f51\u7ad9\u7684\u8d44\u6e90\uff0c\u4f7f\u7528.htaccess\u6587\u4ef6\u540c\u6837\u53ef\u4ee5\u5b9e\u73b0\u9632\u76d7\u94fe\u7684\u529f\u80fd\u3002\u4ee3\u7801\u5982\u4e0b\uff1a<br \/>\n<code>RewriteEngine On<br \/>\nRewriteCond %{HTTP_REFERER} !^http:\/\/domain.com\/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http:\/\/domain.com$ [NC] RewriteCond %{HTTP_REFERER} !^http:\/\/www.domain.com\/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http:\/\/www.domain.com$ [NC] RewriteRule .*\\.(gif|jpg|jpeg|png|bmp|swf|mp3|wav|zip|rar)$ http:\/\/www.domain.com\/404.html [R,NC]<\/code><br \/>\n\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u5224\u65ad\u8bf7\u6c42\u7684referer\uff0c\u5982\u679c\u94fe\u63a5\u4e0d\u662f\u4ece\u672c\u7ad9\u70b9\u51fb\u8fc7\u6765\u7684\uff0c\u9ed8\u8ba4\u90fd\u4f1a\u8df3\u8f6c\u5230\u4e00\u4e2a404\u9875\u9762\u3002\u5728RewriteRule\u4e2d\u6307\u5b9a\u4e86\u8981\u9632\u76d7\u94fe\u7684\u6587\u4ef6\u7c7b\u578b\u3002<\/p>\n<h3>\u9632\u6b62\u5783\u573e\u8bc4\u8bba<\/h3>\n<p>\u4f8b\u7528.htaccess\u540c\u6837\u53ef\u4ee5\u9632\u6b62\u4e00\u90e8\u5206\u6765\u6e90\u4e0d\u660e\u7684\u5783\u573e\u8bc4\u8bba\uff1a<br \/>\n<code>RewriteEngine On<br \/>\nRewriteCond %{REQUEST_METHOD} POST<br \/>\nRewriteCond %{REQUEST_URI} .wp-comments-post\\.php*<br \/>\nRewriteCond %{HTTP_REFERER} !.*domain.com.* [OR] RewriteCond %{HTTP_USER_AGENT} ^$<br \/>\nRewriteRule (.*) ^http:\/\/domain.com\/$ [R=301,L]<\/code><br \/>\n\u8fd9\u6bb5\u4ee3\u7801\uff0c\u5224\u65ad\u4e00\u4e2aPOST\u8bf7\u6c42\u662f\u5426\u662f\u7531\u6d4f\u89c8\u5668\u53d1\u51fa\u7684\uff08\u5224\u65adHTTP_USER_AGENT\u662f\u5426\u4e3a\u7a7a\uff09\uff0c\u5e76\u4e14Refer\u662f\u5426\u672c\u7ad9\u7684\uff0c\u53ea\u8981\u5176\u4e2d\u4efb\u610f\u4e00\u4e2a\u6761\u4ef6\u4e0d\u6ee1\u8db3\uff0c\u5c31\u5c06\u8bf7\u6c42\u81ea\u52a8\u8df3\u8f6c\u5230\u9996\u9875\u3002<\/p>\n<p>\u6ce8\u610f\uff0c\u8fd9\u6bb5\u4ee3\u7801\u53ea\u9002\u7528\u4e8eWordpress\uff0c\u5176\u5b9e\u7684\u6846\u67b6\u53ef\u4ee5\u6839\u636e\u5176\u5177\u4f53\u60c5\u51b5\u628awp-comments-post\u4fee\u6539\u6210\u5bf9\u5e94\u7684URL\u3002<\/p>\n<h3>\u53ea\u5141\u8bb8\u81ea\u5df1\u8bbf\u95eeWordpress\u7684\u540e\u53f0<\/h3>\n<p>\u5982\u679c\u4f60\u6709\u4e00\u4e2a\u56fa\u5b9a\u7684IP\uff0c\u90a3\u4e48\u4f60\u5b8c\u5168\u53ef\u4ee5\u5728.htaccess\u4e2d\u8bbe\u5b9a\u53ea\u6709\u81ea\u5df1\u80fd\u8bbf\u95eeWordpress\u7684\u540e\u53f0\u3002<strong>\u5728wp-admin\u76ee\u5f55\u4e0b\u5efa\u7acb\u4e00\u4e2a\u65b0\u7684.htaccess\u6587\u4ef6<\/strong>\uff0c\u91cc\u9762\u5199\u5165\u5982\u4e0b\u4ee3\u7801\uff1a<br \/>\n<code>AuthUserFile \/dev\/null<br \/>\nAuthGroupFile \/dev\/null<br \/>\nAuthType Basic<br \/>\n&lt;LIMIT GET&gt;<br \/>\norder deny,allow<br \/>\ndeny from all<\/code><\/p>\n<p><code># xx.xx.xx.xx\u4e3a\u60a8\u7684IP\uff0c\u60a8\u4e5f\u4ee5\u8bbe\u5b9a\u591a\u4e2aIP\u3002<br \/>\nallow from xx.xx.xx.xx<br \/>\nallow from xx.xx.xx.xxx<br \/>\n&lt;\/LIMIT&gt;<\/code><br \/>\n\u6ce8\uff1a\u5bf9\u4e8e\u8fd9\u6bb5\u4ee3\u7801\uff0c\u4e00\u5b9a\u662f\u5728wp-admin\u6587\u4ef6\u5939\u4e0b\u5efa\u7acb\u65b0\u7684.htaccess\uff0c\u5f88\u591a\u5751\u7239\u7684\u6587\u7ae0\u90fd\u6ca1\u6709\u544a\u8bc9\u4f60\u8fd9\u4e00\u70b9\uff0c\u76f4\u63a5\u6dfb\u52a0\u5230\u7f51\u7ad9\u6839\u76ee\u5f55\u4e0b\u7684\u90a3\u4e2a.htacess\u4e0b\u7684\u8bdd\u2026\u2026\u60a8\u8981\u662f\u60f3\u8981\u81ea\u5df1\u7684\u6574\u4e2a\u7f51\u7ad9\u90fd\u53ea\u80fd\u81ea\u5df1\u8bbf\u95ee\u7684\u8bdd\uff0c\u4e0d\u59a8\u8bd5\u8bd5\u3002<\/p>\n<h3>\u963b\u6b62\u67d0\u4e9bIP\u8bbf\u95ee\u81ea\u5df1\u7684\u7f51\u7ad9<\/h3>\n<p>\u5982\u679c\u6709\u4e9b\u5783\u573e\u7f51\u7ad9\u7684Robot\u603b\u662f\u4e0d\u505c\u7684\u6293\u53d6\u4f60\u7f51\u7ad9\u7684\u6570\u636e\uff0c\u4f60\u53ef\u4ee5\u5728<a href=\"https:\/\/www.ldhost.cn\/jc\/weberror\/1256.html\" target=\"_blank\" rel=\"noopener\">.htaccess\u4e2d\u5c4f\u853d\u6389\u8fd9\u4e9bIP<\/a>\u3002<br \/>\n<code>&lt;Limit GET POST&gt;<br \/>\norder allow,deny<br \/>\ndeny from xx.xx.xx.xx<br \/>\nallow from all<br \/>\n&lt;\/Limit&gt;<\/code><br \/>\n\u7c7b\u4f3c\u7684\uff0c\u66f4\u6362\u4e00\u4e0bdeny\u548callow\uff0c\u53ef\u4ee5\u5b9e\u73b0\u53ea\u5141\u8bb8\u67d0\u4e9b\u7279\u5b9aIP\u8bbf\u95ee\u81ea\u5df1\u7684\u7f51\u7ad9\uff0c\u5f53\u7136\u5982\u679c\u60a8\u771f\u7684\u60f3\u8981\u8fd9\u4e48\u505a\u7684\u8bdd\u3002<\/p>\n<h3>\u5224\u65ad\u6d4f\u89c8\u5668<\/h3>\n<p>\u6d4f\u89c8\u5668\u517c\u5bb9\u53ef\u4ee5\u8bf4\u662f\u524d\u7aef\u5de5\u7a0b\u5e08\u6700\u4e3a\u5fc3\u75db\u7684\u4e8b\u3002\u4e0e\u5176\u5728css\u4e2d\u5199\u5404\u79cdhack\uff0c\u4e0d\u5982\u5728.htacess\u4e2d\u5224\u65ad\u6d4f\u89c8\u5668\uff0c\u76f4\u63a5\u6307\u5411\u4e0d\u540c\u7684css\u6587\u4ef6\u3002<br \/>\n<code>RewriteCond %{REQUEST_URI} index\\.css*<br \/>\nRewriteCond %{HTTP_USER_AGENT} \"^Mozilla\/4.0$\"<br \/>\nRewriteRule ^(.*)$ http:\/\/domain.com\/firefox.css<\/code><br \/>\n\u7c7b\u4f3c\u7684\uff0c\u5229\u7528.htacess\u5224\u65ad\u8bbf\u95ee\u8005\u662f\u5426\u6301\u6709\u7684\u662f\u79fb\u52a8\u8bbe\u5907\u4e5f\u5f88\u5bb9\u6613\u3002<br \/>\n<code>RewriteEngine on<br \/>\nRewriteCond %{HTTP_USER_AGENT} \"Windows CE\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"NetFront\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"Palm OS\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"Blazer\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"Elaine\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"^WAP.*$\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"Plucker\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"vodafone\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"iPhone\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"nokia\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"symbian\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"Opera Mini\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"BlackBerry\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"j2me\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"midp\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"htc\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"java\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"sony\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"android\" [NC,OR] RewriteCond %{HTTP_USER_AGENT} \"AvantGo\" [NC] RewriteRule (.*) http:\/\/mobi.domain.com\/ [R,L]<\/code><br \/>\n\u56e0\u4e3a\u6709\u70b9\u591a\uff0c\u4e3a\u4e86\u65b9\u4fbf\u9605\u8bfb\uff0c\u8fd8\u6709\u901a\u7528\u7684\u6d4f\u89c8\u5668\u7684USER_AGENT\u653e\u5728\u4e86\u6587\u7ae0\u7684\u6700\u540e\u3002\u6709\u5174\u8da3\u7684\u8bfb\u8005\u53bb\u53ef\u4ee5\u53bb\u770b\u770b\u5427\u3002<\/p>\n<h3>\u7981\u6b62\u8bbf\u95ee\u7279\u5b9a\u7684\u6587\u4ef6\u7c7b\u578b\u6216\u6587\u4ef6<\/h3>\n<p>\u6709\u4e9b\u7279\u5b9a\u7684\u6587\u4ef6\u3001\u6216\u67d0\u4e9b\u6587\u4ef6\uff0c\u6211\u4eec\u53ef\u80fd\u4e0d\u60f3\u8ba9\u7528\u6237\u8bbf\u95ee\u5230\uff0c\u53ef\u4ee5\u7528\u5982\u4e0b\u4ee3\u7801\uff1a<br \/>\n<code>&lt;Files secretfile.jpg&gt;<br \/>\norder allow,deny<br \/>\ndeny from all<br \/>\n&lt;\/Files&gt;<\/code><\/p>\n<p><code>&lt;FilesMatch \".(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$\"&gt;<br \/>\nOrder Allow,Deny<br \/>\nDeny from all<br \/>\n&lt;\/FilesMatch&gt;<\/code><\/p>\n<h3>\u5224\u65ad\u6d4f\u89c8\u5668\u7684\u8bed\u8a00<\/h3>\n<p>\u60f3\u8981\u6839\u636e\u6d4f\u89c8\u5668\u7684\u8bed\u8a00\u8bbe\u5b9a\uff0c\u8df3\u8f6c\u5230\u4e0d\u540c\u7684\u9875\u9762\uff0c\u53ef\u4ee5\u7528\u5982\u4e0b\u4ee3\u7801\uff1a<br \/>\n<code>RewriteCond %{HTTP:Accept-Language} ^zh-cn.*$ [NC] RewriteRule ^\/?$ index_cn.htm [R=301,L]<\/code><\/p>\n<h2>\u603b\u7ed3<\/h2>\n<p>\u5c31\u8bf4\u5230\u8fd9\u91cc\u4e86\uff0c\u5176\u5b9e.htaccess\u7684\u7528\u9014\u8fd8\u6709\u5f88\u591a\u5f88\u591a\uff0c\u8bfb\u8005\u53ef\u4ee5\u6839\u636e\u4e0a\u9762\u7684\u4f8b\u5b50\u81ea\u5df1\u53bb\u6316\u6398.htaccess\u7684\u65b0\u7684\u7528\u9014\u3002\u4e0d\u8fc7\u6ce8\u610f\u4fee\u6539.htaccess\u65f6\u4e00\u5b9a\u8981\u5c0f\u5fc3\uff0c\u56e0\u4e3a\u4e00\u4f46\u5199\u9519\uff0c\u5f88\u53ef\u80fd\u5bfc\u81f4\u6574\u4e2a\u7f51\u7ad9\u90fd\u65e0\u6cd5\u8bbf\u95ee\u3002<\/p>\n<p><strong>\u9644\u5f55\uff1a\u90e8\u5206\u901a\u7528\u7684USER_AGENT<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td>asterias<\/td>\n<td>BackDoorBot<\/td>\n<td>Black.Hole<\/td>\n<td>BlackWidow<\/td>\n<\/tr>\n<tr>\n<td>BlowFish<\/td>\n<td>BotALot<\/td>\n<td>BuiltBotTough<\/td>\n<td>Bullseye<\/td>\n<\/tr>\n<tr>\n<td>BunnySlippers<\/td>\n<td>Cegbfeieh<\/td>\n<td>CheeseBot<\/td>\n<td>CherryPicker<\/td>\n<\/tr>\n<tr>\n<td>ChinaClaw<\/td>\n<td>CopyRightCheck<\/td>\n<td>cosmos<\/td>\n<td>Crescent<\/td>\n<\/tr>\n<tr>\n<td>Custo<\/td>\n<td>DISCo<\/td>\n<td>DittoSpyder<\/td>\n<td>Download\\ Demon<\/td>\n<\/tr>\n<tr>\n<td>eCatch<\/td>\n<td>EirGrabber<\/td>\n<td>EmailCollector<\/td>\n<td>EmailSiphon<\/td>\n<\/tr>\n<tr>\n<td>EmailWolf<\/td>\n<td>EroCrawler<\/td>\n<td>Express\\ WebPictures<\/td>\n<td>ExtractorPro<\/td>\n<\/tr>\n<tr>\n<td>EyeNetIE<\/td>\n<td>FlashGet<\/td>\n<td>Foobot<\/td>\n<td>FrontPage<\/td>\n<\/tr>\n<tr>\n<td>GetRight<\/td>\n<td>GetWeb!<\/td>\n<td>Go-Ahead-Got-It<\/td>\n<td>Googlebot-Image<\/td>\n<\/tr>\n<tr>\n<td>Go!Zilla<\/td>\n<td>GrabNet<\/td>\n<td>Grafula<\/td>\n<td>Harvest<\/td>\n<\/tr>\n<tr>\n<td>hloader<\/td>\n<td>HMView<\/td>\n<td>httplib<\/td>\n<td>HTTrack<\/td>\n<\/tr>\n<tr>\n<td>humanlinks<\/td>\n<td>ia_archiver<\/td>\n<td>Image\\ Stripper<\/td>\n<td>Image\\ Sucker<\/td>\n<\/tr>\n<tr>\n<td>Indy\\ Library<\/td>\n<td>InfoNaviRobot<\/td>\n<td>InterGET<\/td>\n<td>Internet\\ Ninja<\/td>\n<\/tr>\n<tr>\n<td>JennyBot<\/td>\n<td>JetCar<\/td>\n<td>JOC\\ Web\\ Spider<\/td>\n<td>Kenjin.Spider<\/td>\n<\/tr>\n<tr>\n<td>Keyword.Density<\/td>\n<td>larbin<\/td>\n<td>LeechFTP<\/td>\n<td>LexiBot<\/td>\n<\/tr>\n<tr>\n<td>libWeb\/clsHTTP<\/td>\n<td>LinkextractorPro<\/td>\n<td>LinkScan\/8.1a.Unix<\/td>\n<td>LinkWalker<\/td>\n<\/tr>\n<tr>\n<td>lwp-trivial<\/td>\n<td>Mass\\ Downloader<\/td>\n<td>Mata.Hari<\/td>\n<td>Microsoft.URL<\/td>\n<\/tr>\n<tr>\n<td>MIDown\\ tool<\/td>\n<td>MIIxpc<\/td>\n<td>Mister.PiX<\/td>\n<td>Mister\\ PiX<\/td>\n<\/tr>\n<tr>\n<td>moget<\/td>\n<td>Mozilla\/2<\/td>\n<td>Mozilla\/3.Mozilla\/2.01<\/td>\n<td>Mozilla.*NEWT<\/td>\n<\/tr>\n<tr>\n<td>Navroad<\/td>\n<td>NearSite<\/td>\n<td>NetAnts<\/td>\n<td>NetMechanic<\/td>\n<\/tr>\n<tr>\n<td>NetSpider<\/td>\n<td>Net\\ Vampire<\/td>\n<td>NetZIP<\/td>\n<td>NICErsPRO<\/td>\n<\/tr>\n<tr>\n<td>NPBot<\/td>\n<td>Octopus<\/td>\n<td>Offline.Explorer<\/td>\n<td>Offline\\ Explorer<\/td>\n<\/tr>\n<tr>\n<td>Offline\\ Navigator<\/td>\n<td>Openfind<\/td>\n<td>PageGrabber<\/td>\n<td>Papa\\ Foto<\/td>\n<\/tr>\n<tr>\n<td>pavuk<\/td>\n<td>pcBrowser<\/td>\n<td>ProPowerBot\/2.14<\/td>\n<td>ProWebWalker<\/td>\n<\/tr>\n<tr>\n<td>ProWebWalker<\/td>\n<td>QueryN.Metasearch<\/td>\n<td>ReGet<\/td>\n<td>RepoMonkey<\/td>\n<\/tr>\n<tr>\n<td>RMA<\/td>\n<td>SiteSnagger<\/td>\n<td>SlySearch<\/td>\n<td>SmartDownload<\/td>\n<\/tr>\n<tr>\n<td>SpankBot<\/td>\n<td>spanner<\/td>\n<td>SuperBot<\/td>\n<td>SuperHTTP<\/td>\n<\/tr>\n<tr>\n<td>Surfbot<\/td>\n<td>suzuran<\/td>\n<td>Szukacz\/1.4<\/td>\n<td>tAkeOut<\/td>\n<\/tr>\n<tr>\n<td>Teleport<\/td>\n<td>Teleport\\ Pro<\/td>\n<td>Telesoft<\/td>\n<td>The.Intraformant<\/td>\n<\/tr>\n<tr>\n<td>TheNomad<\/td>\n<td>TightTwatBot<\/td>\n<td>Titan<\/td>\n<td>toCrawl\/UrlDispatcher<\/td>\n<\/tr>\n<tr>\n<td>True_Robot<\/td>\n<td>turingos<\/td>\n<td>TurnitinBot\/1.5<\/td>\n<td>URLy.Warning<\/td>\n<\/tr>\n<tr>\n<td>VCI<\/td>\n<td>VoidEYE<\/td>\n<td>WebAuto<\/td>\n<td>WebBandit<\/td>\n<\/tr>\n<tr>\n<td>WebCopier<\/td>\n<td>WebEMailExtrac.*<\/td>\n<td>WebEnhancer<\/td>\n<td>WebFetch<\/td>\n<\/tr>\n<tr>\n<td>WebGo\\ IS<\/td>\n<td>Web.Image.Collector<\/td>\n<td>Web\\ Image\\ Collector<\/td>\n<td>WebLeacher<\/td>\n<\/tr>\n<tr>\n<td>WebmasterWorldForumBot<\/td>\n<td>WebReaper<\/td>\n<td>WebSauger<\/td>\n<td>Website\\ eXtractor<\/td>\n<\/tr>\n<tr>\n<td>Website.Quester<\/td>\n<td>Website\\ Quester<\/td>\n<td>Webster.Pro<\/td>\n<td>WebStripper<\/td>\n<\/tr>\n<tr>\n<td>Web\\ Sucker<\/td>\n<td>WebWhacker<\/td>\n<td>WebZip<\/td>\n<td>Wget<\/td>\n<\/tr>\n<tr>\n<td>Widow<\/td>\n<td>[Ww]eb[Bb]andit<\/td>\n<td>WWW-Collector-E<\/td>\n<td>WWWOFFLE<\/td>\n<\/tr>\n<tr>\n<td>Xaldon\\ WebSpider<\/td>\n<td>Xenu\u2019s<\/td>\n<td>Zeus<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div><img decoding=\"async\" src=\"https:\/\/www.ldhost.cn\/images\/ad-845-3.png\" alt=\"\u56fe\u7247\u63cf\u8ff0\" \/><\/div>","protected":false},"excerpt":{"rendered":"<p>\u6709\u4e9b\u7528\u6237\u53ef\u80fd\u8fd8\u4e0d\u77e5\u9053.htaccess\u6587\u4ef6\u662f\u4ec0\u4e48\uff0c\u6240\u4ee5\u6211\u4eec\u9996\u5148\u6765\u8bf4\u660e\u4e00\u4e0b.htaccess\u7684\u4f5c\u7528\u3002\u5728\u4e50\u9053\u4e3b\u673a\u7684public_html\u6839\u76ee\u5f55\u4e0b\uff0c\u4f60\u4f1a\u770b\u5230\u4e00\u4e2a\u540d\u4e3a.htaccess\u7684\u6587\u4ef6\uff0c\u5b83\u53ef\u4ee5\u662f\u7531\u7cfb\u7edf\u521b\u5efa\u3001\u4e5f\u53ef\u4ee5\u662f\u7528\u6237\u81ea\u5df1\u7f16\u8f91\u800c\u6210\u7684\u3002\u5b83\u662fApache\u670d\u52a1\u5668\u4e2d\u7684\u4e00\u4e2a\u914d\u7f6e\u6587\u4ef6\uff0c\u5b83\u8d1f\u8d23\u76f8\u5173\u76ee\u5f55\u4e0b\u7684\u7f51\u9875\u914d\u7f6e\uff0c\u5bf9\u7f51\u7ad9\u4e2d\u5b9e\u73b0\u6c38\u4e45\u94fe\u63a5(Permalink)\u81f3\u5173\u91cd\u8981\u3002\u540c\u65f6\u5229\u7528\u5b83\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u5b9e\u73b0\uff1a\u7f51\u9875301\u91cd\u5b9a\u5411\u3001\u81ea\u5b9a\u4e49404\u9519\u8bef\u9875\u9762\u3001\u6539\u53d8\u6587\u4ef6\u6269\u5c55\u540d\u3001\u5141\u8bb8\/\u963b\u6b62\u7279\u5b9a\u7684\u7528\u6237\u6216\u8005\u76ee\u5f55\u7684\u8bbf\u95ee\u3001\u7981\u6b62\u76ee\u5f55\u5217\u8868\u3001\u914d\u7f6e\u9ed8\u8ba4\u6587\u6863\u7b49\u529f\u80fd\u3002\u4e0b\u9762\u6211\u4eec\u5c31\u6765\u770b\u770b\u5982\u4f55\u914d\u5236.htaccess\u3002 \u4ee5\u4e0b\u662fWordpress\u4e2d\u9ed8\u8ba4\u7684.htacces&#8230; <a href=\"https:\/\/www.ldhost.cn\/jc\/ot\/965.html\" class=\"readmore\">\u9605\u8bfb\u5168\u6587<span class=\"screen-reader-text\">.htaccess\u7684\u4f7f\u7528\u6280\u5de7<\/span><span class=\"fa fa-angle-double-right\" aria-hidden=\"true\"><\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[18],"class_list":["post-965","post","type-post","status-publish","format-standard","hentry","category-ot","tag-htaccess","content-layout-excerpt-thumb"],"_links":{"self":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts\/965","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/comments?post=965"}],"version-history":[{"count":4,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts\/965\/revisions"}],"predecessor-version":[{"id":967,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts\/965\/revisions\/967"}],"wp:attachment":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/media?parent=965"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/categories?post=965"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/tags?post=965"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}