특별 허용 정책에 추가하는 방법 문의
본문
아래 아이피 대역을 특별허용하려고 합니다.
하나하나 별도로 추가해 주어야 하는지요?
구글봇 아이피 리스트인데
66.249.0.0/27 이렇게 추가하려고 하니
66.249.0.0 아이피가 구글 소유가 아니네요.ㅠ
방법 좀 알려주세요. 감사합니다.
66.249.79.96/27
66.249.79.64/27
66.249.79.32/27
66.249.79.224/27
66.249.79.192/27
66.249.79.160/27
66.249.79.128/27
66.249.79.0/27
66.249.78.32/27
66.249.78.0/27
66.249.77.96/27
66.249.77.64/27
66.249.77.32/27
66.249.77.224/27
66.249.77.192/27
66.249.77.160/27
66.249.77.128/27
66.249.77.0/27
66.249.76.96/27
66.249.76.64/27
66.249.76.32/27
66.249.76.224/27
66.249.76.192/27
66.249.76.160/27
66.249.76.128/27
66.249.76.0/27
66.249.75.96/27
66.249.75.64/27
66.249.75.32/27
66.249.75.224/27
66.249.75.192/27
66.249.75.160/27
66.249.75.128/27
66.249.75.0/27
66.249.74.96/27
66.249.74.64/27
66.249.74.32/27
66.249.74.128/27
66.249.74.0/27
66.249.73.96/27
66.249.73.64/27
66.249.73.32/27
66.249.73.224/27
66.249.73.192/27
66.249.73.160/27
66.249.73.128/27
66.249.73.0/27
66.249.72.96/27
66.249.72.64/27
66.249.72.32/27
66.249.72.224/27
66.249.72.192/27
66.249.72.160/27
66.249.72.128/27
66.249.72.0/27
66.249.71.96/27
66.249.71.64/27
66.249.71.32/27
66.249.71.224/27
66.249.71.192/27
66.249.71.160/27
66.249.71.128/27
66.249.71.0/27
66.249.70.96/27
66.249.70.64/27
66.249.70.32/27
66.249.70.224/27
66.249.70.192/27
66.249.70.160/27
66.249.70.128/27
66.249.70.0/27
66.249.69.96/27
66.249.69.64/27
66.249.69.32/27
66.249.69.224/27
66.249.69.192/27
66.249.69.160/27
66.249.69.128/27
66.249.69.0/27
66.249.68.64/27
66.249.68.32/27
66.249.68.0/27
66.249.66.96/27
66.249.66.64/27
66.249.66.32/27
66.249.66.192/27
66.249.66.160/27
66.249.66.0/27
66.249.65.96/27
66.249.65.64/27
66.249.65.32/27
66.249.65.224/27
66.249.65.192/27
66.249.65.160/27
66.249.65.0/27
66.249.64.96/27
66.249.64.64/27
66.249.64.32/27
66.249.64.224/27
66.249.64.160/27
66.249.64.128/27
66.249.64.0/27
답변 4
function is_ip_allowed($ip, $allowed_patterns) {
foreach ($allowed_patterns as $pattern) {
// 와일드카드 '*'를 정규 표현식의 '.*'으로 변환
$pattern = str_replace('.', '\.', $pattern);
$pattern = str_replace('*', '.*', $pattern);
if (preg_match('/^' . $pattern . '$/', $ip)) {
return true;
}
}
return false;
}
// 아이피대역
$allowed_patterns = [
'66.249.77.*',
'66.249.78.*'
];
// 사용 예
if (!is_ip_allowed($_SERVER['REMOTE_ADDR'], $allowed_patterns)) {
die('Access not allowed');
}
구글봇만 허용하려고 한다면 robots.txt로도 가능합니다.
User-agent: * Disallow: / User-agent: Googlebot Allow: /
제가 올린 글 https://sir.kr/so_ok365/7871도 참조해 보세요.
104.236.+
175.179.+
183.79.+
187.79.+
202.46.+
207.46.13.+
211.36.+
211.39.+
216.145.+
52.68.+
52.69.+
54.+
64.79.+
64.246.+
65.55.+
66.249.+