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 you should 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/2010:05:42:25 -0500] "GET /favicon.ico HTTP/1.1" 404 4503 "http://Hostlantern.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.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Brute Force Attack – What it is and How to Block It

Brute-force is a method of guessing your password by trying combinations of letters, numbers and...

What is pdftoppm and is it supported by Hostlantern?

Pdftoppm is a library that handles the conversion from Portable Document Format (PDF) files to...

How to clear your Internet browser’s cookies?

Sometimes you may need to clear the cookies saved by your browser. Basically the cookies...

Hacked Website

The most common reasons for a hacked (defaced) website include: - Outdated web application....

How to clean my files from malicious code?

If your website has been hacked and malicious content has been inserted into your files, you...