htaccess – How to block internet explorer access?

Question:

How can I block my website from being accessed by iternet explorer via .htaccess? I've already tried codes like:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} "MSIE [6-8]" [NC]
RewriteRule ^(.*)$ http://mysite.com/ie [R=301,L]

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} *MSIE*
RewriteRule ^index\.html$ http://example.com/ie/ [L]
RewriteRule  ^/$ http://example.com/index.html [L]
</IfModule>

But it didn't work, does anyone know any other code that works?

Answer:

Use it like this:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} "MSIE [6-8]" [NC]
RewriteRule ^(.*)$ http://mysite.com/ie [R=301,L]

It will redirect to http://mysite.com/ie , where you can put some message informing the user. Leave just that part, in the part "MSIE [6-8]" is the IE version.

Scroll to Top