리눅스 .htaccess 특정 IP 차단

IT위키
계발자 (토론 | 기여)님의 2024년 5월 1일 (수) 14:26 판 (새 문서: 2가지 방법을 이용할 수 있다. === 단순 차단 (403 처리) === <syntaxhighlight lang="bash" line="1"> <RequireAll> Require all granted Require not ip 123.123.123.123 </RequireAll> </syntaxhighlight> === 특정 페이지로 넘기기 === <syntaxhighlight lang="bash" line="1"> 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] </syntaxhighlight>)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

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]