How to Disable http user agent mozilla firefox only and enable all other browsers in htaccess?

2.1k Views Asked by At

I am currently using this in my .htaccess:

RewriteCond %{HTTP_USER_AGENT} Chrome
RewriteRule .* - [L]
RewriteRule .* http://domain.com/browsererror.html [R,L]

It is working good but what I want is to just disable Mozilla Firefox browser and enable all other browsers. In my current .htaccess I am able to only enable Google Chrome and all other browsers are automatically disabled. is there any short .htaccess code so that I can only disable Mozilla Firefox browser and all other browsers will work fine ? I just want to disable access from Firefox browser.

2

There are 2 best solutions below

0
mani On
# matches regex for Firefox, and redirects to browsererror.html
# can add other browsers to block as ^.*(Firefox|other_browser).*$
RewriteCond %{HTTP_USER_AGENT} ^.*(Firefox).*$ [NC]
RewriteRule .* http://domain.com/browsererror.html [R,L]
1
user7752180 On
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} Chrome
RewriteRule .* - [L]
RewriteCond %{HTTP_USER_AGENT} ^(Mozilla.*|Safari.*|Other.*)$ [NC]
RewriteRule .* - [R=503,L]