웹 서핑을 하다보면 불필요한 광고 때문에 컴퓨터가 버벅되는 경우가 있는데, 간단하게 hosts 파일을 수정해서 IE, FireFox, Chrome 등 어떤 브라우저를 사용하더라도 광고를 보이지 않도록 할수 있습니다. 그리고 그 광고를 원하는 내용으로 바꿀수 있습니다.

- hosts 파일 위치(윈도우즈 버전 마다 다를 수 있음)
C:\Windows\System32\drivers\etc


호스트 파일을 찾았으면 아래와 같이 추가해보자. 필요에 따라 더 추가해도 된다.

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost

# Naver AD
115.94.198.5 nv1.ad.naver.com
내용을 대충 설명하면 해당 도메인으로(nv1.ad.naver.com) 접속을 시도 하면 115.94.198.5 IP 로 인식 하는 것이다.
(IP를 115.94.198.5  대신 127.0.0.1 을 쓰면 해당 도메인으로 접속을 시도 하면 127.0.0.1 즉 내 컴퓨터로 loopback이 되서 도메인 접속이 차단되는 것이다.


호스트 파일 저장후 아래와 같이 광고가 표시 되지 않음을 확인할 수 있다.
사용자 삽입 이미지



지금부터 광고 부분을 수정해보자 . 필자는 115.94.198.5 개인 리눅스 서버를 가지고 있다.

통상 도메인을 호출하면 VHOST 에서 익식하여 /HOME/사용자 형식으로 인식하지만 IP 주소를 호출 하면

/usr/local/apache/htdocs 아래 폴더를 호출한다 htdocs  폴더를 보면 .htaccess 파일이 있다 없을경우 vi .htaccess

로 파을을 생성한다 . 파일 내용에 이렇게 넣어보자 .

Options +FollowSymLinks
RewriteEngine on
ErrorDocument 404 /youngsam.php

내용을 대충 설명하면 404 오류(not found) 파일이 없을경우 /usr/local/apache/htdocs 폴더에 /youngsam.php

파일을 실행 시키는 것이다 .

사용자 삽입 이미지

위 광고 부분 소스를 보면
<iframe id="f595100" name="f595100" src="http://nv1.ad.naver.com/adshow?unit=002AG"
 title="광고" width="595" ..생략

형식으로  http://nv1.ad.naver.com/adshow?unit=002AG 광고 도메인을 불러온다 이럴경우

http://115.94.198.5/adshow?unit=002AG 도메인으로 인식하게된다.
2012/07/17 10:57 2012/07/17 10:57

Trackback Address :: https://youngsam.net/trackback/1800