htaccess和IE8图像无法显示

时间:2021-10-21 11:04:26

I am building a website for a friend, we have decided to simply display an image for users of IE8 and below. I have set up a htaccess. to send anyone using IE8 and below to a different URL. In this new url it is just going to be a simple image displayed telling people our contact details and that there browser is to old. I know this is not the best solution but it is a simple fix until we can learn the best way to go about it.

我正在为朋友建立一个网站,我们决定只为IE8及以下的用户显示图像。我已经建立了一个htaccess。将使用IE8及以下版本的任何人发送到不同的URL。在这个新的网址中,它只是一个简单的图像显示告诉人们我们的联系方式,并且浏览器已经过时了。我知道这不是最好的解决方案,但它是一个简单的解决方案,直到我们可以学习最好的方法。

My problem is that when viewing in IE8 or below, the image is not visible. When viewing in IE9 or Chrome it works perfectly.

我的问题是,在IE8或更低版本中查看时,图像不可见。在IE9或Chrome中查看时,它可以完美运行。

Any help would be much appreciated, I have included the code I have used below.

任何帮助将不胜感激,我已经包含了我在下面使用的代码。

RewriteEngine on 
RewriteCond %{HTTP_USER_AGENT} "MSIE 6"  [OR] 
RewriteCond %{HTTP_USER_AGENT} "MSIE 7"  [OR]
RewriteCond %{HTTP_USER_AGENT} "MSIE 8"  
RewriteRule (.*) IE/index.html

I have then used the following IE/index.html

然后我使用了以下IE / index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>

</head>

<body>
<img src="/IE/comingsoon.png" width="1024" height="768" />



</body>
</html>

Any help would be much appreciated. Cheers Peter

任何帮助将非常感激。干杯彼得

1 个解决方案

#1


1  

Of course it won't be, you're trapping any requests from IE6/7/8 and redirecting them to this page. So when those browsers load this page, parse it, find the image, and try to load that image, the image request gets redirected as well, and they end up trying to use the HTML as an image.

当然不会,你正在捕获来自IE6 / 7/8的任何请求并将它们重定向到这个页面。因此,当这些浏览器加载此页面,解析它,查找图像并尝试加载该图像时,图像请求也会被重定向,并且他们最终会尝试将HTML用作图像。

You need to explicitly EXCLUDE anything in your IE folder from redirection by those browsers.

您需要通过这些浏览器的重定向显式排除IE文件夹中的任何内容。

RewriteCond %{REQUEST_URI} !^IE

#1


1  

Of course it won't be, you're trapping any requests from IE6/7/8 and redirecting them to this page. So when those browsers load this page, parse it, find the image, and try to load that image, the image request gets redirected as well, and they end up trying to use the HTML as an image.

当然不会,你正在捕获来自IE6 / 7/8的任何请求并将它们重定向到这个页面。因此,当这些浏览器加载此页面,解析它,查找图像并尝试加载该图像时,图像请求也会被重定向,并且他们最终会尝试将HTML用作图像。

You need to explicitly EXCLUDE anything in your IE folder from redirection by those browsers.

您需要通过这些浏览器的重定向显式排除IE文件夹中的任何内容。

RewriteCond %{REQUEST_URI} !^IE