Quantcast
Channel: apache – softelメモ
Viewing all articles
Browse latest Browse all 68

【apache】mod_setenvifなどでアクセス制限

$
0
0

問題

User-AgentやRefererでアクセス制限したい。

apache-icon

答え

User-Agentでアクセス制御の例

特定のUser-Agentの時アクセスを拒否する例

# MSN
SetEnvIfNoCase User-Agent "msnbot" shutout

# Google
SetEnvIf User-Agent "Googlebot" shutout
SetEnvIf User-Agent "Googlebot-Image" shutout
Deny from 66.249.64.0/19

# Yahoo
SetEnvIf User-Agent "Slurp" shutout
SetEnvIfNoCase User-Agent "Yahoo" shutout
Deny from 72.30.0.0/16
Deny from 74.6.0.0/16


order Allow,Deny
Allow from all
Deny from env=shutout

Refererでアクセス制御の例

SetEnvIf Referer "http://foo.example.com" shutout
SetEnvIf Referer "http://bar.example.jp" shutout

order Allow,Deny
Allow from all
Deny from env=shutout


Viewing all articles
Browse latest Browse all 68

Trending Articles