2013-12-07 2 views
0

Добрый день.Как добавить исключение в htaccess для RewriteCond?

Код Htaccess:

# Block out any script trying to base64_encode data within the URL. 
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR] 
# Block out any script that includes a <script> tag in URL. 
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR] 
# Block out any script trying to set a PHP GLOBALS variable via URL. 
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] 
# Block out any script trying to modify a _REQUEST variable via URL. 
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) 
# Return 403 Forbidden header and show the content of the root homepage 
RewriteRule .* index.php [F] 

И у нас есть файл: site.com/files/file.php

Как добавить исключение в Htaccess для этого файла (добавить исключение в RewriteCond для этого файла)?

ответ

0

Вы можете добавить новое условие, как это:

RewriteCond %{REQUEST_URI} !^/files/file\.php 
# Block out any script trying to base64_encode data within the URL. 
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR] 
# Block out any script that includes a <script> tag in URL. 
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR] 
# Block out any script trying to set a PHP GLOBALS variable via URL. 
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] 
# Block out any script trying to modify a _REQUEST variable via URL. 
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) 
# Return 403 Forbidden header and show the content of the root homepage 
RewriteRule .* index.php [F] 
+0

не работает. не ошибка в строке '! ^/files.file \ .php'? –

+0

Каков ваш полный URL-адрес, который вы пробовали? Это 'http: // domain.com/files/file.php'? – anubhava

+0

Извините, опечатка в моих правилах исправлена. Пожалуйста, попробуйте еще раз. – anubhava

Смежные вопросы