리눅스 .htaccess 특정 IP 차단

IT위키

2가지 방법을 이용할 수 있다.

단순 차단 (403 처리)[편집 | 원본 편집]

<RequireAll>
  Require all granted
  Require not ip 123.123.123.123
</RequireAll>

특정 페이지로 넘기기[편집 | 원본 편집]

RewriteCond %{HTTP:X-FORWARDED-FOR} ^123.123.123.123$ [OR]
RewriteCond %{REMOTE_ADDR} ^123.123.123.123$ 
RewriteRule !blocked.php$ /blocked.php [L,R=301]