WorkHolic
아파치 - 특정 쿼리 단어로 URL 차단
gromet
2024. 1. 12. 19:41
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]
728x90
SMALL