{"id":616,"date":"2006-06-06T20:42:52","date_gmt":"2006-06-06T08:42:52","guid":{"rendered":""},"modified":"2006-06-06T20:42:52","modified_gmt":"2006-06-06T08:42:52","slug":"","status":"publish","type":"post","link":"https:\/\/www.mudone.com\/?p=616","title":{"rendered":"\u5229\u7528.htaccess \u5b9e\u73b0\u7a7a\u95f4\u9632\u76d7\u94fe"},"content":{"rendered":"<p>From:<a href=\"http:\/\/www.aaoo.net\/blog\/index.php?action=show&amp;id=134\" title=\"http:\/\/www.aaoo.net\/blog\/index.php?action=show&amp;id=134\" target=\"_blank\">http:\/\/www.aaoo.net\/blog\/index.php?action=show&amp;id=134<\/a><\/p>\n<p>\u7f51\u7ad9\u6d41\u91cf\u5360\u7528\u6700\u5927\u7684\u662f\u6587\u4ef6\u4e0b\u8f7d\u3001\u5927\u5c3a\u5bf8\u56fe\u7247\u3002\u5f88\u591a\u4eba\u559c\u6b22\u5f15\u7528\u5176\u4ed6\u7ad9\u70b9\u7684\u56fe\u7247\uff0c\u5bfc\u81f4\u975e\u672c\u7ad9\u663e\u793a\u8bbf\u95ee\u7684\u6d41\u91cf\u731b\u589e\u52a0\u3002<\/p>\n<p>\u4e0d\u7ba1\u51fa\u4e8e\u4ec0\u4e48\u539f\u56e0\uff0c\u5404\u79cd\u9632\u76d7\u94fe\u624b\u6bb5\u90fd\u6765\u4e86\u3002<\/p>\n<p>\u9632\u76d7\u94fe\u539f\u7406\uff1a<\/p>\n<p>http\u6807\u51c6\u534f\u8bae\u4e2d\u6709\u4e13\u95e8\u7684\u5b57\u6bb5\u8bb0\u5f55referer<\/p>\n<p>\u4e00\u6765\u53ef\u4ee5\u8ffd\u6eaf\u4e0a\u4e00\u4e2a\u5165\u7ad9\u5730\u5740\u662f\u4ec0\u4e48<\/p>\n<p>\u4e8c\u6765\u5bf9\u4e8e\u8d44\u6e90\u6587\u4ef6\uff0c\u53ef\u4ee5\u8ddf\u8e2a\u5230\u5305\u542b\u663e\u793a\u4ed6\u7684\u7f51\u9875\u5730\u5740\u662f\u4ec0\u4e48\u3002<\/p>\n<p>\u56e0\u6b64\u6240\u6709\u9632\u76d7\u94fe\u65b9\u6cd5\u90fd\u662f\u57fa\u4e8e\u8fd9\u4e2aReferer\u5b57\u6bb5<\/p>\n<p>\u7f51\u4e0a\u6bd4\u8f83\u591a\u7684\uff12\u79cd<\/p>\n<p>\u4e00\u79cd\u662f\u4f7f\u7528apache\u6587\u4ef6FileMatch\u9650\u5236\uff0c\u5728httpd.conf\u4e2d\u589e\u52a0 ( \u5176\u5b9e\u4e5f\u53ef\u4ee5\u5c06\u628a\u4e0b\u9762\u7684\u8bed\u53e5\u5b58\u6210\u4e00\u4e2a.htaccess\u6587\u4ef6)\uff0c\u5e76\u653e\u5230\u4f60\u7684\u7f51\u7ad9\u7684\u6839\u76ee\u5f55\uff08\u5c31\u662fwww\/html\u76ee\u5f55\uff09\uff0c\u8fd9\u6837\u5b50\u522b\u4eba\u5c31\u6ca1\u6709\u529e\u6cd5\u76d7\u8fde\u4f60\u7684\u4e1c\u4e1c\u4e86~~<\/p>\n<p>SetEnvIfNoCase Referer <!--more-->&quot;^<a href=\"http:\/\/yahoo.com\/\" title=\"http:\/\/yahoo.com\/\" target=\"_blank\">http:\/\/yahoo.com\/<\/a>&quot; local_ref=1<\/p>\n<p>Order Allow,Deny<br \/>\nAllow from env=local_ref<br \/>\nAllow from 127.0.0.1<\/p>\n<p>\u8fd9\u79cd\u5f88\u65b9\u4fbf\u7981\u6b62\u975e\u5141\u8bb8\u8bbf\u95eeURL\u5f15\u7528\u5404\u79cd\u8d44\u6e90\u6587\u4ef6<\/p>\n<p>\u8bf7\u5927\u5bb6\u6ce8\u610f\uff0c\u628a\u7b2c\u4e00\u53e5&quot;^<a href=\"http:\/\/yahoo.com\/\" title=\"http:\/\/yahoo.com\/\" target=\"_blank\">http:\/\/yahoo.com\/<\/a>&quot;\u6539\u4e3a\u4f60\u7684\u7f51\u7ad9\uff0c\u6bd4\u5982\u6211\u7684\u7f51\u7ad9\u662f\uff1a <a href=\"http:\/\/www.linji.cn\" title=\"http:\/\/www.linji.cn\" target=\"_blank\">http:\/\/www.linji.cn<\/a><br \/>\n\u6211\u5e94\u8be5\u8fd9\u4e48\u5199\u7684<br \/>\n&quot;^<a href=\"http:\/\/www.linji.cn\/\" title=\"http:\/\/www.linji.cn\/\" target=\"_blank\">http:\/\/www.linji.cn\/<\/a>&quot;<\/p>\n<p>\u7b2c\u4e8c\u79cd\u662f\u4f7f\u7528rewrite,\u9700\u8981\u589e\u52a0apache\u7684mode_rewrite\uff0c\u652f\u6301.htaccess\u6587\u4ef6\u76ee\u5f55\u6743\u9650\u9650\u5236<br \/>\n\u5728\u865a\u62df\u4e3b\u673a\u6839\u76ee\u5f55\u589e\u52a0.htaccess\u6587\u4ef6\uff0c\u63cf\u8ff0\u4ece\u5b9a\u5411\uff0c\u628a\u975e\u672c\u5730\u5730\u5740refer\u7684\u56fe\u7247\u6587\u4ef6\u90fd\u4ece\u5b9a\u5411\u5230\u8b66\u544a\u56fe\u7247\u6216\u8005\u8b66\u544a\u7f51\u9875\u4e0a\u3002<\/p>\n<p>\u9996\u5148\u8981\u786e\u8ba4\u4f60\u7684\u670d\u52a1\u5668\u6216\u7a7a\u95f4\u7684\u670d\u52a1\u5668\u89e3\u8bd1\u5f15\u64ce\u4e3aApache2\uff0c\u8fd8\u6709\u652f\u6301.htaccess\u5ba2\u6237\u8bbe\u7f6e\u6587\u4ef6\uff0c<br \/>\n\u5982\u679c\u4f60\u6709\u81ea\u5df1\u7684\u670d\u52a1\u5668\u5c31\u8bf7\u5148\u5bf9.\/conf\/httpd.conf \u6587\u4ef6\u505a\u4ee5\u4e0b\u4fee\u6539<br \/>\n\u627e\u5230\uff1a#LoadModule rewrite_module modules\/mod_rewrite.so<br \/>\n\u628a\u524d\u9762\u7684 # \u7ed9\u53bb\u4e22<br \/>\n\u627e\u5230\u7b49\u4e00\u4e2a AllowOverride None \u6539\u4e3a AllowOverride All<br \/>\n\u91cd\u542fApache2\u670d\u52a1\u5668<\/p>\n<p>\u63a5\u4e0b\u5c31\u662f\u505a\u4e00\u4e2a .htaccess \u6587\u4ef6\u4e86\uff0c\u5176 .htaccess \u6587\u4ef6\u5185\u5bb9\u4e3a<\/p>\n<p>RewriteEngine on<br \/>\nRewriteCond %{HTTP_REFERER} !^<a href=\"http:\/\/aaoo.net\/.*$\" title=\"http:\/\/aaoo.net\/.*$\" target=\"_blank\">http:\/\/aaoo.net\/.*$<\/a>      [NC]<br \/>\nRewriteCond %{HTTP_REFERER} !^<a href=\"http:\/\/aaoo.net$\" title=\"http:\/\/aaoo.net$\" target=\"_blank\">http:\/\/aaoo.net$<\/a>      [NC]<br \/>\nRewriteCond %{HTTP_REFERER} !^<a href=\"http:\/\/www.aaoo.net\/.*$\" title=\"http:\/\/www.aaoo.net\/.*$\" target=\"_blank\">http:\/\/www.aaoo.net\/.*$<\/a>      [NC]<br \/>\nRewriteCond %{HTTP_REFERER} !^<a href=\"http:\/\/www.aaoo.net$\" title=\"http:\/\/www.aaoo.net$\" target=\"_blank\">http:\/\/www.aaoo.net$<\/a>      [NC]<br \/>\nRewriteRule .*.(<span style=\"color:Blue\">jpg|jpeg|gif|png|bmp|rar|zip|exe<\/span>)$ <span style=\"color:Green\">http:\/\/down.yoyo.com.ru\/err.html<\/span> [R,NC]<\/p>\n<p>\u5176\u4e2d\u6709\u8272\u7684\u5730\u65b9\u90fd\u662f\u8981\u6539\u4e3a\u4f60\u7684\uff1a<br \/>\n\u3000\u7ea2\u8272\uff1a\u5c31\u662f\u6539\u4e3a\u4f60\u63d0\u4f9b\u4e0b\u8f7d\u9875\u9762\u7684\u5730\u5740\uff0c\u4e5f\u5c31\u662f\u53ea\u6709\u901a\u8fc7\u8fd9\u4e2a\u5730\u5740\u624d\u53ef\u4ee5\u4e0b\u8f7d\u4f60\u6240\u63d0\u4f9b\u7684\u4e1c\u4e1c\u3002<br \/>\n\u3000\u84dd\u8272\uff1a\u5c31\u662f\u8981\u4fdd\u62a4\u6587\u4ef6\u7684\u6269\u5c55\u540d(\u4ee5|\u5206\u5f00)\uff0c\u4e5f\u5c31\u662f\u8bf4\u4ee5\u8fd9\u4e9b\u4e3a\u6269\u5c55\u540d\u7684\u6587\u4ef6\u53ea\u6709\u901a\u8fc7\u7ea2\u8272\u7684\u5730\u5740\u624d\u53ef\u4ee5\u8bbf\u95ee\u3002<br \/>\n\u3000\u7eff\u8272\uff1a\u5982\u679c\u4e0d\u662f\u901a\u8fc7\u7ea2\u8272\u7684\u5730\u5740\u8bbf\u95ee\u84dd\u8272\u8fd9\u4e9b\u4e3a\u6269\u5c55\u540d\u7684\u6587\u4ef6\u65f6\u5c31\u56de\u91cd\u5b9a\u5411\u5230\u7eff\u8272\u5730\u5740\u4e0a\u3002<\/p>\n<p>\u8fd9\u4e2a\u65b9\u6cd5\u6709\u4e2a\u597d\u5904\u662f\uff0c\u4e0d\u540c\u7684\u865a\u62df\u4e3b\u673a\u7528\u4e0d\u540c\u7684\u63cf\u8ff0\u5b9a\u4e49\u3002<\/p>\n<p>\u63a5\u4e0b\u5c31\u662f\u600e\u4e48\u7528 .htaccess \u6587\u4ef6\u6765\u5b9e\u73b0\u9632\u76d7\u94fe\u4e86\u3002<br \/>\n\u3000\u9996\u5148\u8981\u5728\u7a7a\u95f4\u4e0a\u5efa\u4e24\u4e2a\u76ee\u5f55(\u5f53\u7136\u76ee\u5f55\u540d\u968f\u4f60)\uff0c\u4e00\u4e2a\u4e3a web \u53e6\u4e00\u4e2a\u4e3a down \uff0c<br \/>\n\u3000web \u662f\u7528\u6765\u653e\u4e0b\u8f7d\u9875\u9762\u7684(\u6216\u4e0b\u8f7d\u7a0b\u5e8f)\uff0cdown \u5f53\u7136\u5c31\u662f\u653e\u4f60\u63d0\u4f9b\u7684\u4e1c\u4e1c\u7684\u5566\uff0c<br \/>\n\u3000\u628a .htaccess \u6587\u4ef6\u7684\u7ea2\u8272\u90e8\u5206\u6539\u4e00\u4e0b\uff0c\u6539\u4e3a<a href=\"http:\/\/\u4f60\u7684\u57df\u540d\/web\u3002\u84dd\u8272\u90e8\u5206\" title=\"http:\/\/\u4f60\u7684\u57df\u540d\/web\u3002\u84dd\u8272\u90e8\u5206\" target=\"_blank\">http:\/\/\u4f60\u7684\u57df\u540d\/web\u3002\u84dd\u8272\u90e8\u5206<\/a><br \/>\n\u3000\u6539\u4e3a\u4f60\u8981\u4fdd\u62a4\u6587\u4ef6\u7684\u6269\u5c55\u540d\u3002\u7eff\u8272\u90e8\u5206\u6539\u4e3a<a href=\"http:\/\/\u4f60\u7684\u57df\u540d\/web\u3002\u6539\u540e\u4fdd\u5b58\" title=\"http:\/\/\u4f60\u7684\u57df\u540d\/web\u3002\u6539\u540e\u4fdd\u5b58\" target=\"_blank\">http:\/\/\u4f60\u7684\u57df\u540d\/web\u3002\u6539\u540e\u4fdd\u5b58<\/a><br \/>\n\u3000.htaccess \u6587\u4ef6\u628a\u5b83\u4e0a\u4f20\u5230 down \u76ee\u5f55\u3002<\/p>\n<p>\u8fd8\u6709\u7b2c\u4e09\u79cd\uff1a<\/p>\n<p>\u6211\u5728\u89e3\u51b3plog\u7981\u6b62\u76d7\u94fe\u7684\u65f6\u5019\uff0c\u53d1\u73b0\u4e2a\u95ee\u9898\uff0c\u4e5f\u7b97\u4e2a\u597d\u65b9\u6cd5\u3002<br \/>\nplog\u628a\u6240\u6709\u8d44\u6e90\u90fd\u81ea\u5df1\u7ba1\u7406\u8d77\u6765\uff0c\u7528resserver.php\u6765\u52a8\u6001\u663e\u793a\uff0c\u8fd9\u6837\u7edf\u4e00\u7684\u5165\u53e3\u65b9\u4fbf\u6dfb\u52a0\u6743\u9650\u64cd\u4f5c\u3002<br \/>\n\u540c\u65f6\u9020\u6210\u4e0a\u9762\uff12\u79cd\u65b9\u6cd5\u65e0\u6cd5\u4f7f\u7528\uff0c\u56e0\u4e3a\u4e0d\u518d\u662fapache\u76f4\u63a5\u8bbf\u95ee\u8d44\u6e90\u6587\u4ef6\uff0c\u800c\u662fphp\u901a\u8fc7\u6587\u4ef6\u8bfb\u53d6\u3002<\/p>\n<p>\u56e0\u6b64\u53ea\u80fd\u5728\u4ee3\u7801\u4e2d\u505a\u624b\u811a\uff1a\u5728\u8bfb\u53d6\u8d44\u6e90\u6587\u4ef6\u8f93\u51fa\u4e4b\u524d\uff0c\u52a0\u5982\u4e0b\u5224\u65ad\u4ee3\u7801<\/p>\n<div class=\"quote\">\n<div class=\"quote-title\">\u5f15\u7528\u81ea <u><\/u><\/div>\n<div class=\"quote-content\">  $referer = $_SERVER[&#39;HTTP_REFERER&#39;];<br \/>\n   $selfurl = $_SERVER[&#39;HTTP_HOST&#39;];<br \/>\n   if(false == strpos($referer,$selfurl))<br \/>\n   {<br \/>\n       echo &#39;\u975e\u6cd5\u76d7\u94fe!&#39;;<br \/>\n       exit(1);<br \/>\n   }<\/div>\n<\/div>\n<p>\u8fd9\u91cc\u6709\u4e9b\u5077\u61d2\uff0c\u76f4\u63a5\u770b\u5f15\u7528\u5730\u5740\u4e2d\u662f\u5426\u5305\u542bhost\u5730\u5740\uff0c\u4e0d\u8fc7\u539f\u7406\u5c31\u662f\u8fd9\u6837\uff0c\u5224\u65adreferer\u662f\u5426\u662f\u672c\u7ad9\u5730\u5740\u3002<\/p>\n<p>\u6211\u4eec\u5e38\u5e38\u5728\u4e0b\u8f7d\u7684\u65f6\u5019\uff0c\u4e5f\u78b0\u5230\u76d7\u94fe\u7f51\u7ad9\u65e0\u6cd5\u4e0b\u8f7d\uff0c\u62a5\u76d7\u94fe\u7684\u95ee\u9898\u3002\u8981\u4e0b\u8f7d\u8fd9\u7c7b\u6587\u4ef6\u6700\u7b80\u5355\u7684\u65b9\u6cd5\u5c31\u662f\u6539referer<\/p>\n<p>\u6bd4\u65b9flashget\u4e2d\uff0c\u7f51\u5740\u4e0b\u9762\u7684&quot;\u5f15\u7528&quot;\u4e00\u680f\u4e2d\uff0c\u76f4\u63a5\u586b\u5199\u4e0b\u8f7d\u5730\u5740\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>\u597d\u4e86\u8fd9\u6837\u5c31\u5b8c\u6210\u4e86\uff0c\u7b80\u5355\u5427\uff0c\u73b0\u5728\u4f60\u4e0d\u9700\u8981\u53bb\u4e70\u90a3\u4e9b\u6240\u4e3a\u7684\u5927\u5f62\u670d\u52a1\u5668\u5c31\u7528\u8fd9\u6837<br \/>\n\u529f\u80fd\uff0c\u6211\u4eec\u53ef\u662f\u5c71\u4e0b\u7684\u4eba\u6709\u94b1\u4e0a\u7f51\u641e\u4e2aFREE\u7a7a\u95f4\u5c31\u7b97\u4e0d\u9519\u5570\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>From:http:\/\/www.aaoo.net\/blog\/index.php?action=show&#038;amp [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[],"tags":[],"class_list":["post-616","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.mudone.com\/index.php?rest_route=\/wp\/v2\/posts\/616","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mudone.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mudone.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mudone.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mudone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=616"}],"version-history":[{"count":0,"href":"https:\/\/www.mudone.com\/index.php?rest_route=\/wp\/v2\/posts\/616\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.mudone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=616"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mudone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=616"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mudone.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}