# Заборонити доступ за User-Agent

Цей метод зазвичай використовують у випадку, якщо доступ до сайту потрібно заблокувати для скриптів або ботів, які мають динамічну IP-адресу.

{% code title=".htaccess" %}

```apacheconf
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} example1 [NC,OR]
RewriteCond %{HTTP_USER_AGENT} example2 [NC]
RewriteRule ^.*$ - [F]
```

{% endcode %}

Замість example1 і example2 вкажіть імена User-Agent'ів ботів або скриптів, доступ яких необхідно заблокувати.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://olexsyn.gitbook.io/enote/linux/apache/htaccess/modrewrite/ua-deny.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
