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

时间:2016-06-29 21:44:03

标签: php .htaccess browser explorer

我已将以下内容添加到我的.htaccess文件中,用于bit.ly/29bG9uv。但是,在Internet Explorer 11中访问bit.ly/29bG9uv时,它似乎并没有阻止我。

想法?需要阻止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

3 个答案:

答案 0 :(得分:0)

这可能有助于阻止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>

答案 1 :(得分:0)

要阻止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]

答案 2 :(得分:0)

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