Home
/
Website Help
/
Other
/
How to allow/deny access to your website based on the visitor's browser?

How to allow/deny access to your website based on the visitor's browser?

Using Apache .htaccess rules you can deny a visitor depending on his/her browser identification. For example to deny Opera browser accessing your site you can use the following rules:

BrowserMatchNoCase opera bad_browser
Order Deny,Allow
Deny from env=bad_browser

If you wonder what string to use, check your site access log. We have decided to use opera in the above example because of the following example:

10.1.1.1 – – [07/Jul/2018:05:42:25 -0500] “GET /favicon.ico HTTP/1.1” 404 4503 “https://siteground.com/” “Opera/9.64 (X11; Linux i686; U; en) Presto/2.1.1

In fact, you can use any of the bold text in order to create a filter.

Share This Article