728x90
반응형

아파치 - 특정 쿼리 단어로 URL 차단

 

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine On
RewriteCond %{QUERY_STRING} (test|user|password) [NC]
RewriteRule .* - [F,L]
</VirtualHost>

 

아래와 같이 시도하면 그 아래와 같이 차단한다.


curl -I  http://www.gameking.tips?test=1
curl -I  http://www.gameking.tips?var1=user
curl -I  http://www.gameking.tips?mypassword=abcd

HTTP/1.1 403 Forbidden
Date: Sun, 18 Apr 2021 18:18:53 GMT
Server: Apache/2.4.41 (Ubuntu)
Content-Type: text/html; charset=iso-8859-1

 

HTACCESS를 사용하여 특정 쿼리 문자열로 URL 차단

 

vi /var/www/html/.htaccess

RewriteEngine On
RewriteCond %{QUERY_STRING} (test|user|password) [NC]
RewriteRule .* - [F,L]

 

참고 - https://techexpert.tips/ko/apache-ko/%ec%95%84%ed%8c%8c%ec%b9%98-%ed%8a%b9%ec%a0%95-%ec%bf%bc%eb%a6%ac-%eb%8b%a8%ec%96%b4%eb%a1%9c-url-%ec%b0%a8%eb%8b%a8/

728x90
SMALL
Posted by gromet

블로그 이미지
나는 운이 좋은 사람이다 나는 나날이 점점 더 좋아진다 내가 하는 선택과 행동은 반드시 성공으로 이어진다 내게는 인내력과 지속력이 있다 네게는 좋은것들만 모여든다
gromet

공지사항

Yesterday
Today
Total
반응형

달력

 « |  » 2024.7
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

160x600