リモートホスト/IPアドレスでのアクセス制限
忙しいので今回も旧サイトからの転載です。すんません。
ちょうど良い機会なので(謎)。.htaccessシリーズ第二弾。
.htaccessに下記のように記述することで、特定のホスト及びIPアドレスに対してアクセス制限をかけることができます。
order allow,deny allow from all deny from aaa.bbb.ne.jp deny from ccc.ddd.co.jp
これでaaa.bbb.ne.jpとccc.ddd.co.jpというホストからのアクセスを制限することができます。
allow: アクセスを許可するホスト/IP
deny: アクセスを拒否するホスト/IP
です。
上記の場合は、「基本的に全部のアクセスを許可するけどaaa.bbb.ne.jpとccc.ddd.co.jpからはアクセスしちゃ駄目」という意味になります。
逆に、特定のホスト/IPからのみアクセスを許可したい場合は、
order deny,allow deny from all allow from aaa.bbb.ne.jp
となります。
これは、「基本的に全部のアクセスを拒否するけどaaa.bbb.ne.jpからはアクセスしてOK」という意味になります。
自分専用のWebアプリケーションの管理ツール等を設置するディレクトリに設定しておくと良いですね。
もちろん、外出先等からその管理ツールにアクセスできなくなるという難点もあります。
他には、携帯専用サイトでDoCoMoやau、vodafoneのホストからのみ受け付けるよう設定する、とか。
allow及びdenyに指定できるホスト名は、後方一致でワイルドカード的に指定することができます。
aaa1.bbb.ne.jpやaaa2.bbb.ne.jp、aaa3.bbb.ne.jp等を一括でアクセス制限したい場合は
order allow,deny allow from all deny from .bbb.ne.jp
とすれば、ホストの末尾が.bbb.ne.jpからのアクセスを全て拒否できます。
ただし、この使い方は無関係な人までアクセス拒否してしまう可能性が非常に高いので、設定する場合はその辺を考慮に入れる必要があります。
allow及びdenyには、ホスト名だけでなくIPアドレスも指定できます。
IPアドレスをワイルドカード的に指定する場合は前方一致です。また、サブネットマスクによる範囲指定も可能です。
order allow,deny allow from all deny from 192.168.0.1 deny from 192.168.1. deny from 192.168.2.0/255.255.255.0 deny from 192.168.3.0/16
こんな感じで。
「アクセス制限をかける」という行為自体が私はあまり好きではないのですが、誰でもデータベース内の情報を編集できる、所謂wikiのような「性善説系」サイトを長年やってると、やはり必要悪だなと特に改めて思わされますね。
- 現在位置
- TOP > Web制作技術 > .htaccess > リモートホスト/IPアドレスでのアクセス制限
- 前のブログ記事
- 同人ゲーム『ひぐらしのなく頃に』が実写映画化だってさ [2007年8月13日 23:59]
- 次のブログ記事
- ケータイメールで鬼ごっこ [2007年8月15日 23:59]
コメント(9)
qjcjozfs http://paydayloansnsa.com/ payday loans
coach bags
Coach Handbags Clearance http://www.hardpresseditions.com/coach1.html
uetidiv http://paydayloanshst.com/ payday loans
sgmoxqma [url=http://sdfxyc.com/]ltwhgpes[/url]
Blood pressure is determined, jiffy close to second, close the deliberate between heart efficiency versus overall circumferential defences underground and varies depending on berth, emotional regal, interest, and relative health/disease states. viagra without a doctor prescription is regulated close the brain via both the perturbed and endocrine systems.
As you can go through from the blood sway chart, simply one of the numbers has to be higher viagra without a doctor prescription or modulate than it should be to number as either high blood bring pressure to bear on or debilitated blood crushing:
The best evidence indicates that enormous blood albatross does not cause headaches or nosebleeds, except in the turn out that in the event of of hypertensive moment, a medical emergency when blood difficulties is 180/110 mm Hg or higher. If your blood pressure is unusually high viagra without a doctor prescription you have headache or nosebleed and are feeling unwell, wait five minutes and retest. If your reading remains at 180/110 mm Hg or higher, call 9-1-1.
The nicest demonstration indicates that high blood insistence does not justification headaches or nosebleeds, except in the box of hypertensive turning-point, a medical emergency when blood burden is 180/110 mm Hg or higher. If your blood compel is unusually weighty viagra without a doctor prescription you accept problem or nosebleed and are feeling unwell, pause five minutes and retest. If your reading remains at 180/110 mm Hg or higher, call 9-1-1.
The rout attest indicates that merry blood insistence does not justification headaches or nosebleeds, except in the case of hypertensive catastrophe, a medical exigency when blood tension is 180/110 mm Hg or higher. If your blood pressure is unusually weighty viagra without a doctor prescription you have problem or nosebleed and are feeling unwell, wait five minutes and retest. If your reading remains at 180/110 mm Hg or higher, christen 9-1-1.
コメントする