如何阻止IE11访问者访问我的页面?htaccess


How do I block IE11 visitors from visiting my page? htaccess?

我已经为bit.ly/29bG9uv的.htaccess文件添加了以下内容。然而,它似乎并没有阻止我参观bit。

想法?需要阻止IE11访问者访问bit.ly/29bG9uv

# BEGIN GD-SSL
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{SERVER_NAME} ^domain'.com$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Header add Strict-Transport-Security "max-age=300"
</IfModule>
# END GD-SSL

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www'.(.+)$
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

IE11使用字符串"Trident"来标识它的浏览器引擎。你可以使用下面的代码来阻止IE11

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} .*Trident.* [NC]
RewriteRule ^ - [R=403]

您可能还想阻止旧版本的IE。为此,使用字符串"MSIE"

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} .*MSIE.* [NC]
RewriteRule ^ - [R=403]

如果你想将所有IE用户重定向到一个单独的页面,例如可能要求他们下载不同的浏览器,你可以使用

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} .*MSIE.* [NC]
RewriteRule ^(.*) ie.html
RewriteCond %{HTTP_USER_AGENT} .*Trident.* [NC]
RewriteRule ^(.*) ie.html

这可能有助于阻止IE浏览器:

<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>

要阻止IE11用户代理,可以使用:

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} IE11 [NC]
RewriteRule ^ - [R=403,L]

这将阻止整个站点的IE11,他们得到一个403禁止错误。如果您想阻止特定的页面,那么您可以使用:

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} IE11 [NC]
RewriteRule ^page - [R=403,L]