S
S
sbh2015-12-29 06:27:11
htaccess
sbh, 2015-12-29 06:27:11

How to make access with only 1 useragent?

Tell me how to restrict access to all but 1 useragent?
For example, let it be Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36

Answer the question

In order to leave comments, you need to log in

3 answer(s)
H
hbmozg, 2015-12-29
@hbmozg

On nginx?

S
sbh, 2015-12-30
@sbh

Apache

D
dim565, 2015-02-19
@dim565

There was also a need to block all User-Agents, except for one (white list). I achieved the maximum of this kind in .htaccess:

SetEnvIfNoCase User-Agent "Chrome/40.0.2214.111 Safari/537.36 OPR/27.0.1689.69" mozno
Order Deny,Allow
Deny from All
Allow from env=mozno

The result is access only from Opera 27.0.1689.69.
But for some reason, if I write a full useragent, for example, like this "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36 OPR/27.0.1689.69" - it stops entering and with Opera, although through access_log the line is 100% consistent with what I am writing.
You can try the same thing with RewriteEngine, but the first option worked for me.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question