В каком месте должен быть код?

P
На сайте с 10.07.2015
Offline
1
694

Запрет доступа по HTTP заголовку referer для блокировки нежелательного входящего трафика:

RewriteEngine On

Options +FollowSymlinks

RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*semalt\.com\ [NC,OR]

RewriteRule .* – [F]

конкретно в каком месте файла .htaccess должен стоять?

RewriteEngine On

########## Begin - Rewrite rules to block out some common exploits

## If you experience problems on your site block out the operations listed below

## This attempts to block the most common type of exploit `attempts` to Joomla!

#

## Deny access to extension xml files (uncomment out to activate)

#<Files ~ "\.xml$">

#Order allow,deny

#Deny from all

#Satisfy all

#</Files>

## End of deny access to extension xml files

# Block out any script trying to set a mosConfig value through the URL

RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]

# 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]

#

########## End - Rewrite rules to block out some common exploits

########## Begin - Custom redirects

#

# If you need to redirect some pages, or set a canonical non-www to

# www redirect (or vice versa), place that code here. Ensure those

# redirects use the correct RewriteRule syntax and the [R=301,L] flags.

#

########## End - Custom redirects

# Uncomment following line if your webserver's URL

# is not directly related to physical file paths.

# Update Your Joomla! Directory (just / for root)

# RewriteBase /

########## Begin - Joomla! core SEF Section

#

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

#

# If the requested path and file is not /index.php and the request

# has not already been internally rewritten to the index.php script

RewriteCond %{REQUEST_URI} !^/index\.php

# and the request is for root, or for an extensionless URL, or the

# requested URL ends with one of the listed extensions

RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw))$ [NC]

# and the requested path and file doesn't directly match a physical file

RewriteCond %{REQUEST_FILENAME} !-f

# and the requested path and file doesn't directly match a physical folder

RewriteCond %{REQUEST_FILENAME} !-d

# internally rewrite the request to the index.php script

RewriteRule .* index.php [L]

#

########## End - Joomla! core SEF Section

siv1987
На сайте с 02.04.2009
Offline
427
#1

После RewriteEngine On который должен быть только один.

P
На сайте с 10.07.2015
Offline
1
#2

Например так? Хеш нужно ставить? (выделено жирным)

RewriteEngine On

########## Begin - Rewrite rules to block out some common exploits

## If you experience problems on your site block out the operations listed below

## This attempts to block the most common type of exploit `attempts` to Joomla!

#

## Deny access to extension xml files (uncomment out to activate)

#<Files ~ "\.xml$">

#Order allow,deny

#Deny from all

#Satisfy all

#</Files>

## End of deny access to extension xml files

# Block out any script trying to set a mosConfig value through the URL

RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]

# 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]

# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*semalt\.com\ [NC,OR]
RewriteRule .* – [F]

#

########## End - Rewrite rules to block out some common exploits

SocFishing
На сайте с 26.09.2013
Offline
118
#3

# обозначает не использовать строку. Да, нужно убрать #

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?site.com/ [nc]

запретит загрузку вашего сайта с внешних источников.

★Сервис идентифицирует (https://socfishing.com/?utm_source=searchengines) посетителей вашего сайта и предоставляет их профили ВКонтакте, Телефон, Почта! Цены копеечные, работаем 8 лет.
P
На сайте с 10.07.2015
Offline
1
#4
SocFishing:
# обозначает не использовать строку. Да, нужно убрать #



запретит загрузку вашего сайта с внешних источников.

Спасибо за разъяснение, но ваш код отличается от того что я нашел "на просторах". Есть какое-то принципиальное различие?

И еще. Как прописать если нужно отметить несколько сайтов?

SocFishing
На сайте с 26.09.2013
Offline
118
#5

Верно ли я понимаю, что вам нужно заблокировать ваш сайт от загрузки внешними ресурсами. Например загрузка ваших картинок и скриптов другими сайтами. Тогда:

<IfModule mod_headers.c>
Header always append X-Frame-Options DENY
</IfModule>

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?gogog.ru/ [nc]
RewriteRule (.*) http://127.0.0.1 [nc]

просто замените домен gogog.ru на ваш

для проверки попробуйте загрузить с другого домена:

<img src="http://gogog.ru/logo.png">

и загрузка сайта программно, загружать следует с другого домена для проверки

<?php echo file_get_contents('http://gogog.ru/logo.png');
P
На сайте с 10.07.2015
Offline
1
#6
SocFishing:
Верно ли я понимаю, что вам нужно заблокировать ваш сайт от загрузки внешними ресурсами. Например загрузка ваших картинок и скриптов другими сайтами. Тогда:


просто замените домен gogog.ru на ваш

для проверки попробуйте загрузить с другого домена:


и загрузка сайта программно, загружать следует с другого домена для проверки

Нет, речь идет о фейковом трафике. Имеются переходы с таких ресурсов как:

semalt.com
buttons-for-website.com
и т.п.

Меня это беспокоит. Хочу отсечь.

Быть может я напрасно беспокоюсь?

SocFishing
На сайте с 26.09.2013
Offline
118
#7

Директивы могут не везде работать

RewriteEngine on
RewriteCond %{HTTP_REFERER} 1111.ru [NC,OR]
RewriteCond %{HTTP_REFERER} 2222.ru
RewriteRule .* – [F]

Сделал для вас на php, вставьте в header сайта

<?php
if (isset($_SERVER['HTTP_REFERER'])) {
$domains = '111111.ru|222222.ru';
$referer = parse_url($_SERVER['HTTP_REFERER'])['host'];
if (stripos($domains, $referer) === false) {
} else {
header("Status: 404 Not Found");
exit();
}
}
?>
P
На сайте с 10.07.2015
Offline
1
#8

Спасибо. Такое решение мне не попадалось. Будем пробовать.

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий