Y
Y
Ysery2019-09-22 01:03:28
Apache HTTP Server
Ysery, 2019-09-22 01:03:28

Block access via .htaccess if the IP starts with certain numbers, and the referrer is like this, how?

If the visitor's IP address starts with:
194.
or
185.
and the User Agent has the following string Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/ 57.0 false positive)
Then block access (403). What is the design for this would be .htaccess?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2019-09-22
@Ysery

Something like this:

RewriteCond %{HTTP_USER_AGENT} "^Mozilla\/5\.0 \(Windows NT 6\.1; Win64; x64; rv:57.0\) Gecko\/20100101 Firefox\/57\.0$"
RewriteCond %{REMOTE_ADDR} "^(194|185)\."
RewriteRule .* - [F]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question