아파치에서 다음 URL을 어떻게 금지합니까?쿼리 문자열을 기반으로 Apache mod_rewrite에서 URL을 금지하는 방법은 무엇입니까?
main/index.php?site=ing
나는 다음을 시도;
RewriteRule ^main/index.php?site=ing - [F]
하지만 운
...아파치에서 다음 URL을 어떻게 금지합니까?쿼리 문자열을 기반으로 Apache mod_rewrite에서 URL을 금지하는 방법은 무엇입니까?
main/index.php?site=ing
나는 다음을 시도;
RewriteRule ^main/index.php?site=ing - [F]
하지만 운
...당신 cannot match a query string in the RewriteRule, 당신은
RewriteCond %{QUERY_STRING} site=ing #Adjust the regexps with anchors
RewriteRule ^main/index.php - [F]
또 다른 비 아파치 솔루션을 할 필요는 index.php 파일에서이 작업을 수행하는 것 .
페이지 맨위로 다음과 같은 페이지를 추가하십시오.
if(isset($_GET['site']) && $_GET['site'] == 'ing'){
header('HTTP/1.1 403 Forbidden');
exit();
}
이 그것을 수행해야합니다 사람들이 찾을 쿼리 문자열과 mod_rewrite의 문제를 검색 할 수 있도록
RewriteCond %{QUERY_STRING} (^|&)site=ing(&|$)
RewriteRule ^main/index\.php$ - [F]
나는 제목과 태그 모두에서 "쿼리 문자열"을 추가했다. –