PHP Tip
Apache의 에서 User-Agent 기반으로 특정 봇을 차단하는 방식입니다.
duaidot
2025. 12. 14. 03:17
# 특정 User-Agent(봇) 문자열을 감지해서 bad_bot 환경변수로 지정
BrowserMatchNoCase "AhrefsBot" bad_bot
BrowserMatchNoCase "SemrushBot" bad_bot
BrowserMatchNoCase "MJ12bot" bad_bot
# 접근 제어 순서: Allow 규칙 먼저, 그 다음 Deny 규칙 적용
Order Allow,Deny
# 기본적으로 모든 요청을 허용
Allow from all
# bad_bot 환경변수가 설정된 경우 접근 차단 (403 Forbidden)
Deny from env=bad_bot