{"id":1607,"date":"2021-12-17T11:04:39","date_gmt":"2021-12-17T02:04:39","guid":{"rendered":"https:\/\/tech.at-iroha.jp\/?p=1607"},"modified":"2026-04-06T13:53:59","modified_gmt":"2026-04-06T04:53:59","slug":"mod_rewrite-%e3%82%92%e7%94%a8%e3%81%84%e3%81%9f%e6%a7%98%e3%80%85%e3%81%aa%e3%82%a2%e3%82%af%e3%82%bb%e3%82%b9%e5%88%b6%e5%be%a1","status":"publish","type":"post","link":"https:\/\/tech.at-iroha.jp\/?p=1607","title":{"rendered":"mod_rewrite \u3092\u7528\u3044\u305f\u69d8\u3005\u306a\u30a2\u30af\u30bb\u30b9\u5236\u5fa1"},"content":{"rendered":"\n<p>\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u306b\u516c\u958b\u3055\u308c\u3066\u3044\u308bWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u7d76\u3048\u305a\u69d8\u3005\u306a\u653b\u6483\u306b\u3055\u3089\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u3088\u3046\u306a\u653b\u6483\u3092\u9632\u3050\u305f\u3081\u306b\u306f\u3001Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u653b\u6483\u5bfe\u8c61\u3068\u306a\u308b\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30db\u30fc\u30eb\u3092\u4f5c\u3089\u306a\u3044\u3053\u3068\u304c\u5927\u5207\u3067\u3059\u304c\u3001Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u69d8\u3005\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3084\u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u8907\u96d1\u306b\u7d61\u307f\u5408\u3063\u3066\u304a\u308a\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30db\u30fc\u30eb\u3092\u5b8c\u5168\u306b\u7121\u304f\u3059\u3053\u3068\u306f\u6975\u3081\u3066\u56f0\u96e3\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002\u307e\u305f\u30bc\u30ed\u30c7\u30a4\u653b\u6483\u306e\u3088\u3046\u306b\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30db\u30fc\u30eb\u306e\u767a\u898b\u3001\u5bfe\u7b56\u304c\u884c\u308f\u308c\u308b\u524d\u306b\u653b\u6483\u306b\u3055\u3089\u3055\u308c\u308b\u3053\u3068\u3082\u8fd1\u5e74\u3001\u3068\u3066\u3082\u5897\u52a0\u3057\u3066\u3044\u307e\u3059\u3002\u305d\u3053\u3067\u4eca\u56de\u3001Web\u30b5\u30fc\u30d0\u306b\u5bfe\u3059\u308b\u4e0d\u5fc5\u8981\u306a\u30a2\u30af\u30bb\u30b9\u3092\u53ef\u80fd\u306a\u9650\u308a\u30d6\u30ed\u30c3\u30af\u3059\u308b\u305f\u3081\u306b\u3001mod_rewrite \u3092\u7c21\u6613\u7684\u306aWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d5\u30a1\u30a4\u30e4\u30fc\u30a6\u30a9\u30fc\u30eb\u3068\u3057\u3066\u7528\u3044\u308b\u3053\u3068\u3092\u8a66\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>mod_rewrite  \u306f Apache \u7528\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3001URL\u306e\u66f8\u304d\u63db\u3048\u3092\u884c\u3046\u3053\u3068\u3092\u76ee\u7684\u306b\u53e4\u304f\u304b\u3089\u4f7f\u7528\u3055\u308c\u3066\u304d\u307e\u3057\u305f\u3002\u3057\u304b\u3057\u306a\u304c\u3089 mod_rewrite  \u306fURL\u306e\u66f8\u304d\u63db\u3048\u3060\u3051\u3067\u306f\u306a\u304f\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3084\u30ea\u30af\u30a8\u30b9\u30c8\u3001\u30d6\u30e9\u30a6\u30b6\u306e\u60c5\u5831\u3092\u5143\u306b\u6761\u4ef6\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u69d8\u3005\u306a\u30a2\u30af\u30bb\u30b9\u3092\u5236\u5fa1\u3092\u884c\u3046\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u5177\u4f53\u7684\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30a2\u30af\u30bb\u30b9\u5236\u5fa1\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u7279\u5b9a\u306eIP\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u7279\u5b9a\u306eIP\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u306e\u307f\u3092\u8a31\u53ef<\/li><li>\u7279\u5b9a\u306e\u30db\u30b9\u30c8\u540d\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/li><li>\u7279\u5b9a\u306eURL\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/li><li>\u7279\u5b9a\u306e\u6587\u5b57\u5217\u3092\u542b\u3080\u30e6\u30fc\u30b6\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/li><li>\u7279\u5b9a\u306e\u6587\u5b57\u5217\u3092\u542b\u3080\u30ea\u30d5\u30a1\u30e9\u30fc\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/li><li>\u7279\u5b9a\u306e\u6587\u5b57\u5217\u3092\u542b\u3080\u30af\u30c3\u30ad\u30fc\u304c\u3042\u308b\u5834\u5408\u306e\u307f\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/li><li>\u7279\u5b9a\u306e\u8a00\u8a9e\u306e\u30d6\u30e9\u30a6\u30b6\u306e\u307f\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/li><li>\u7279\u5b9a\u306e\u30af\u30a8\u30ea\u6587\u5b57\u5217\u3092\u542b\u3080\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/li><li>\u7279\u5b9a\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30e1\u30bd\u30c3\u30c9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/li><li>\u7279\u5b9a\u306e\u65e5\u6642\u3001\u6642\u9593\u5e2f\u306e\u307f\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/li><\/ul>\n\n\n\n<p>\u4e0a\u8a18\u306e\u6761\u4ef6\u306f\u5168\u3066\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002mod_rewrite \u3092Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 \u30d5\u30a1\u30a4\u30e4\u30fc\u30a6\u30a9\u30fc\u30eb\u3068\u3057\u3066\u5229\u7528\u3059\u308b\u5834\u5408\u306e\u30e1\u30ea\u30c3\u30c8\u3001\u30c7\u30e1\u30ea\u30c3\u30c8\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u30e1\u30ea\u30c3\u30c8<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u6c4e\u7528\u6027\u304c\u9ad8\u3044\u3002OS\u3084\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3001Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u4f9d\u5b58\u305b\u305a\u306b\u8a2d\u5b9a\u304c\u53ef\u80fd\u3002<\/li><li>\u69d8\u3005\u306a\u30a2\u30af\u30bb\u30b9\u5236\u9650\u306e\u30eb\u30fc\u30eb\u30921\u3064\u306e\u30d5\u30a1\u30a4\u30eb\uff08.htaccess\uff09\u3067\u7c21\u6f54\u306b\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/li><\/ul>\n\n\n\n<p><strong>\u30c7\u30e1\u30ea\u30c3\u30c8<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u52d5\u7684\u306a\u30eb\u30fc\u30eb\u306e\u4f5c\u6210\u304c\u96e3\u3057\u3044\u3002\uff08\u4f8b\u3048\u3070\u4e00\u5b9a\u56de\u6570\u30a2\u30af\u30bb\u30b9\u3057\u305f\u5834\u5408\u306b\u62d2\u5426\u3059\u308b\u7b49\uff09<\/li><li>\u901a\u4fe1\u5185\u5bb9\uff08POST\u30c7\u30fc\u30bf\u7b49\uff09\u306b\u3088\u308b\u30eb\u30fc\u30eb\u306e\u4f5c\u6210\u304c\u3067\u304d\u306a\u3044\u3002<\/li><li>\u6b63\u898f\u8868\u73fe\u3084\u72ec\u81ea\u306e\u8a18\u8ff0\u65b9\u6cd5\u3092\u7406\u89e3\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">mod_rewrite \u306e\u5229\u7528\u65b9\u6cd5<\/h2>\n\n\n\n<p> mod_rewrite \u3092\u5229\u7528\u3059\u308b\u306b\u306f\u4e8b\u524d\u306b Apache \u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\uff08httpd.conf\uff09\u306b\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5f62\u5f0f\u3067  rewrite_module   \u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30ed\u30fc\u30c9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>LoadModule rewrite_module modules\/mod_rewrite.so<\/code><\/pre>\n\n\n\n<p>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3054\u3068\u306e\u8a2d\u5b9a\u3092\u6709\u52b9\u3059\u308b\u305f\u3081\u306b\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b &lt;Directory \/&gt; \u5185\u3067 AllowOverride All \u3068\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002\u5b9f\u969b\u306e  mod_rewrite \u306e\u8a2d\u5b9a\u306b\u3064\u3044\u3066\u306f\u3001\u5bfe\u8c61\u3068\u306a\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b .htaccess \u30d5\u30a1\u30a4\u30eb \u3092\u4f5c\u6210\u3057\u3001\u305d\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;Directory \"\/var\/www\/html\/xxx\"&gt;\nAllowOverride All\n&lt;\/Directory&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">.htaccess \u30d5\u30a1\u30a4\u30eb\u306e\u4f5c\u6210\u65b9\u6cd5<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u57fa\u672c\u69cb\u6587<\/h3>\n\n\n\n<p>\u30a2\u30af\u30bb\u30b9\u5236\u5fa1\u3092\u3059\u308b\u5bfe\u8c61\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b  .htaccess \u30d5\u30a1\u30a4\u30eb \u3092\u4f5c\u6210\u3057\u3001\u30a2\u30af\u30bb\u30b9\u5236\u5fa1\u306e\u8a2d\u5b9a\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002\u57fa\u672c\u69cb\u6587\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u6761\u4ef61\u3092\u6e80\u305f\u3059\u5834\u5408\u306b\u30a2\u30af\u30bb\u30b9\u62d2\u5426\nRewriteCond \u6761\u4ef61\nRewriteRule ^.*$ - &#91;F,L]\n\n# \u6761\u4ef61\u3068\u6761\u4ef62\u3092\u6e80\u305f\u3059\u5834\u5408\u306b\u30a2\u30af\u30bb\u30b9\u62d2\u5426 (AND\u6761\u4ef6)\nRewriteCond \u6761\u4ef61\nRewriteCond \u6761\u4ef62\nRewriteRule ^.*$ - &#91;F,L]\n\n# \u6761\u4ef61\u3082\u3057\u304f\u306f\u6761\u4ef62\u3092\u6e80\u305f\u3059\u5834\u5408\u306b\u30a2\u30af\u30bb\u30b9\u62d2\u5426 (OR\u6761\u4ef6)\nRewriteCond \u6761\u4ef61 &#91;OR]\nRewriteCond \u6761\u4ef62\nRewriteRule ^.*$ - &#91;F,L]<\/code><\/pre>\n\n\n\n<p>RewriteCond  \u306e\u884c\u306b\u6761\u4ef6\u3092\u3001 RewriteRule  \u306b\u6761\u4ef6\u306b\u4e00\u81f4\u3059\u308b\u5834\u5408\u306b\u9069\u7528\u3059\u308bURL\u306e\u66f8\u304d\u63db\u3048\u30eb\u30fc\u30eb\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002\u6761\u4ef6\u306f\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>^  \u30fb\u30fb\u30fb \u5148\u982d\u3068\u30de\u30c3\u30c1\n$  \u30fb\u30fb\u30fb \u672b\u5c3e\u3068\u30de\u30c3\u30c1\n.* \u30fb\u30fb\u30fb \u4efb\u610f\u306e\u6587\u5b57\u5217\uff08\u30ef\u30a4\u30eb\u30c9\u30ab\u30fc\u30c9\uff09\n\\. \u30fb\u30fb\u30fb \u30c9\u30c3\u30c8\n.  \u30fb\u30fb\u30fb \u534a\u89d2\u7a7a\u767d\n!  \u30fb\u30fb\u30fb \u30de\u30c3\u30c1\u3057\u306a\u3044\u5834\u5408<\/code><\/pre>\n\n\n\n<p>\u307e\u305f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u72ec\u81ea\u30d5\u30e9\u30b0\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;OR] \u30fb\u30fb\u30fb OR\u6761\u4ef6\u3068\u3059\u308b\n&#91;NC] \u30fb\u30fb\u30fb\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\n&#91;F] \u30fb\u30fb\u30fb 403-Forbidden\uff08\u30a2\u30af\u30bb\u30b9\u7981\u6b62\uff09\n&#91;L] \u30fb\u30fb\u30fb \u7d42\u4e86<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u7279\u5b9a\u306eIP\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u7279\u5b9a\u306eIP\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u306e\u307f\u3092\u8a31\u53ef<\/h3>\n\n\n\n<p>\u4f8b\u3048\u3070IP\u30a2\u30c9\u30ec\u30b9\u300112.12.12.12 \u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3059\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteEngine On\nRewriteCond   %{REMOTE_ADDR} ^12\\.12\\.12\\.12$\nRewriteRule ^.*$ - &#91;F,L]<\/code><\/pre>\n\n\n\n<p>\u9006\u306b IP\u30a2\u30c9\u30ec\u30b9\u300112.12.12.12 \u304b\u3089\u306e\u307f\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u53ef\u3059\u308b\u5834\u5408\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteEngine On\nRewriteCond   %{REMOTE_ADDR} !^12\\.12\\.12\\.12$\nRewriteRule ^.*$ - &#91;F,L]<\/code><\/pre>\n\n\n\n<p>\u305f\u3060\u3057IP\u30a2\u30c9\u30ec\u30b9\u306b\u3088\u308b\u30a2\u30af\u30bb\u30b9\u5236\u9650\u306f\u3001Apache \u81ea\u4f53\u306e\u6a5f\u80fd\u306b\u3088\u3063\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u7c21\u6f54\u306b\u8a18\u8ff0\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>deny from 12.12.12.12<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>deny from all\nallow from 12.12.12.12<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u7279\u5b9a\u306e\u30db\u30b9\u30c8\u540d\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/h3>\n\n\n\n<p> \u4f8b\u3048\u3070 xxx.com \u3067\u7d42\u308f\u308b\u30db\u30b9\u30c8\u540d\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3059\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteEngine On\nRewriteCond   %{HTTP_HOST} ^.*xxx\\.com$\nRewriteRule ^.*$ - &#91;F,L]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u7279\u5b9a\u306eURL\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/h3>\n\n\n\n<p>\u4f8b\u3048\u3070 \/admin \u306eURL\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3059\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002  <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteCond %{REQUEST_URI} ^.*\/admin.*$ &#91;NC]\nRewriteRule ^.*$ - &#91;F,L]<\/code><\/pre>\n\n\n\n<p>IP\u30a2\u30c9\u30ec\u30b9 12.12.12.12 \u306e\u307f \/admin \u306eURL\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u53ef\u3059\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002 \u3053\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u7279\u5b9a\u306e\u5834\u6240\u304b\u3089\u306e\u307f\u7ba1\u7406\u753b\u9762\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u53ef\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteCond %{REQUEST_URI} ^.*\/admin.*$ &#91;NC]\nRewriteCond %{REMOTE_ADDR} !^12.12.12.12$\nRewriteRule ^.*$ - &#91;F,L]\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u7279\u5b9a\u306e\u6587\u5b57\u5217\u3092\u542b\u3080\u30e6\u30fc\u30b6\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/h3>\n\n\n\n<p>\u30e6\u30fc\u30b6\u30a8\u30fc\u30b8\u30a7\u30f3\u306b\u7279\u5b9a\u306e\u6587\u5b57\u5217\uff08spider, bot, python \u3044\u305a\u308c\u304b\u306e\u6587\u5b57\u5217\uff09\u3092\u542b\u3080\u5834\u5408\u306e\u307f\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3059\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u3063\u3066\u30b7\u30a7\u30eb\u3084\u30dc\u30c3\u30c8\u306b\u3088\u308b\u7121\u5dee\u5225\u306a\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteCond %{HTTP_USER_AGENT} ^.*(spider|bot|python).*$ &#91;NC]\nRewriteRule ^.*$ - &#91;F,L]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u7279\u5b9a\u306e\u30ea\u30d5\u30a1\u30e9\u30fc\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/h3>\n\n\n\n<p>\u30ea\u30d5\u30a1\u30e9\u30fc\u306b\u7279\u5b9a\u306e\u6587\u5b57\u5217\uff08 aaa, bbb \u306e\u3044\u305a\u308c\u304b\u306e\u6587\u5b57\u5217\uff09\u3092\u542b\u3080\u5834\u5408\u306e\u307f\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3059\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteCond %{HTTP_REFERER} ^.*(aaa|bbb).*$ &#91;NC,OR]\nRewriteRule ^.*$ - &#91;F,L]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u7279\u5b9a\u306e\u6587\u5b57\u5217\u3092\u542b\u3080\u30af\u30c3\u30ad\u30fc\u304c\u3042\u308b\u5834\u5408\u306e\u307f\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/h3>\n\n\n\n<p>\u30e6\u30fc\u30b6\u306e\u30d6\u30e9\u30a6\u30b6\u306b\u7279\u5b9a\u306e\u6587\u5b57\u5217\uff08SESSION_ID\uff09\u3092\u542b\u3080\u30af\u30c3\u30ad\u30fc\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\u306e\u307f\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u53ef\u3059\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u3063\u3066\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u306a\u3044\u30e6\u30fc\u30b6\u306f\u3001\u7279\u5b9a\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30d5\u30a1\u30a4\u30eb\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3059\u308b\u3068\u3044\u3063\u305f\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteCond %{HTTP_COOKIE} ^.*(SESSION_ID).*$ &#91;NC]\nRewriteRule ^.*$ - &#91;F,L]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u7279\u5b9a\u306e\u8a00\u8a9e\u306e\u30d6\u30e9\u30a6\u30b6\u306e\u307f\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/h3>\n\n\n\n<p>\u4f8b\u3048\u3070\u65e5\u672c\u8a9e\u3001\u82f1\u8a9e\u306e\u30d6\u30e9\u30a6\u30b6\u306e\u307f\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u53ef\u3059\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteCond %{HTTP:Accept-Language} !^(ja|en).*$ &#91;NC]\nRewriteRule ^.*$ - &#91;F,L]<\/code><\/pre>\n\n\n\n<p>\u9006\u306b\u30ed\u30b7\u30a2\u8a9e\u306e\u30d6\u30e9\u30a6\u30b6\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3059\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteCond %{HTTP:Accept-Language} ^(ru).*$ &#91;NC]\nRewriteRule ^.*$ - &#91;F,L]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u7279\u5b9a\u306e\u30af\u30a8\u30ea\u6587\u5b57\u5217\u3092\u542b\u3080\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/h3>\n\n\n\n<p>\u30af\u30a8\u30ea\u6587\u5b57\u5217\u306b\u7279\u5b9a\u306e\u6587\u5b57\u5217\uff08select, update, insert\uff09\u3092\u542b\u3080\u5834\u5408\u306e\u307f\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3059\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u3063\u3066SQL\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u306e\u4e00\u90e8\u3084\u60aa\u610f\u306e\u3042\u308b\u30a2\u30af\u30bb\u30b9\u306e\u4e00\u90e8\u3092\u62d2\u5426\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteCond %{QUERY_STRING} ^.*(select|update|insert).*$ &#91;NC]\nRewriteRule ^.*$ - &#91;F,L]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u7279\u5b9a\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30e1\u30bd\u30c3\u30c9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/h3>\n\n\n\n<p>\u4f8b\u3048\u3070 GET\u3001POST \u4ee5\u5916\u306e\u30a2\u30af\u30bb\u30b9\u3092\u5168\u3066\u62d2\u5426\u3059\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteCond %{REQUEST_METHOD} !^.*(GET|POST).*$ &#91;NC]\nRewriteRule ^.*$ - &#91;F,L]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u7279\u5b9a\u306e\u65e5\u6642\u3001\u6642\u9593\u5e2f\u306e\u307f\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3001\u3082\u3057\u304f\u306f\u8a31\u53ef<\/h3>\n\n\n\n<p>\u4f8b\u3048\u30702022\u5e741\u67081\u65e5\u4ee5\u964d\u306e\u30a2\u30af\u30bb\u30b9\u3092\u5168\u3066\u62d2\u5426\u3059\u308b\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteCond %{TIME} &gt;20220101000000\nRewriteRule ^.*$ - &#91;F,L]<\/code><\/pre>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306b\u4e8b\u524d\u306b\u5916\u90e8\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3084\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u3001\u30d6\u30e9\u30a6\u30b6\u306e\u8a00\u8a9e\u3092\u9650\u5b9a\u3057\u3001\u7279\u5b9a\u306e\u30e6\u30fc\u30b6\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3001\u30ea\u30d5\u30a1\u30e9\u30fc\u3001\u30af\u30a8\u30ea\u6587\u5b57\u5217\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u30e1\u30bd\u30c3\u30c9\u3092\u62d2\u5426\u3059\u308b\u3053\u3068\u3067\u3001Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3084\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u8106\u5f31\u6027\u3092\u72d9\u3063\u305f\u7121\u5dee\u5225\u306a\u653b\u6483\u3082\u304b\u306a\u308a\u306e\u5272\u5408\u3067\u30d6\u30ed\u30c3\u30af\u3067\u304d\u308b\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002\u5b9f\u969b\u3001\u8a66\u9a13\u7684\u306b\u904b\u7528\u4e2d\u306e Web \u30b5\u30a4\u30c8\u306b\u9069\u7528\u3057\u3001\u30a2\u30af\u30bb\u30b9\u30ed\u30b0\u3092\u89b3\u5bdf\u3057\u305f\u3068\u3053\u308d\u30011\u65e5\u6570\u767e\u4ef6\u8fd1\u304f\u3042\u3063\u305f\u6a5f\u68b0\u7684\u306a\u4e0d\u6b63\u30a2\u30af\u30bb\u30b9\u304c\u6570\u4ef6\u7a0b\u5ea6\u306b\u6e1b\u5c11\u3057\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u306b\u516c\u958b\u3055\u308c\u3066\u3044\u308bWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u7d76\u3048\u305a\u69d8\u3005\u306a\u653b\u6483\u306b\u3055\u3089\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u3088\u3046\u306a\u653b\u6483\u3092\u9632\u3050\u305f\u3081\u306b\u306f\u3001Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u653b\u6483\u5bfe\u8c61\u3068\u306a\u308b\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30db\u30fc\u30eb\u3092\u4f5c\u3089\u306a\u3044\u3053\u3068\u304c\u5927\u5207\u3067\u3059\u304c\u3001Web\u30a2\u30d7\u30ea\u30b1\u30fc [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1612,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"class_list":["post-1607","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security"],"_links":{"self":[{"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=\/wp\/v2\/posts\/1607","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1607"}],"version-history":[{"count":18,"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=\/wp\/v2\/posts\/1607\/revisions"}],"predecessor-version":[{"id":1645,"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=\/wp\/v2\/posts\/1607\/revisions\/1645"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=\/wp\/v2\/media\/1612"}],"wp:attachment":[{"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1607"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1607"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}