Knowledge Base Article

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

Using the Apache Environment variables, you can allow or deny access to your website based on the browser the visitor is using.

 

To do this, you should add the following lines to your .htaccess file:

 

SetEnvIf User-Agent ^Mozilla 5.0 browser
Order Deny,Allow
Deny from all
Allow from env=browser

 

 

The above code will deny access to your website for all visitors using Mozilla Firefox.

 

For other browsers, you should replace Mozilla 5.0 with the corresponding agent. For example, if you wish to deny access to all visitors using Opera 9.5, you should replace Mozilla 5.0 with Opera 9.5.



Rating

Please indicate if this article was helpful for you.

rating :  4.3 from 5
views :  1175
votes :  6

Haven't found what you are looking for? Suggest an article HERE.

powered by

Valid XHTML 1.0 Strict Valid CSS!