【问题标题】:IIS 8.5 HTTP Redirect VS FaviconIIS 8.5 HTTP 重定向 VS Favicon
【发布时间】:2015-02-20 14:41:06
【问题描述】:

你好!

问题是当 http 重定向在 IIS 8.5 中处于活动状态时,网站图标不会出现。 我的操作系统是windows server 2012 r2,网页浏览器是IE11。

我做什么: 我去IIS 8.5,点击http重定向,勾选第一个选项,输入http链接然后应用。运行iisreset,清除IE现金,重新加载页面。 favicon.ico 位于 wwwroot 文件夹中。

我尝试过的:

-在 IIS 中添加 mime 类型(".ico" = "image/x-icon" 或 ".ico" = "image/vnd.microsoft.icon")

-在页面中添加链接(link rel="icon" type="image/x-icon" href="/favicon.ico")

-网站生成的不同图标。

请帮帮我!

谢谢

**[EDIT]**

This is how redirect is set in IIS:

--------------------------------
HTTP Redirect

Use the feature to specify rules for redirecting incoming requests to   antoher file or URL.

V Redirect requests to this destination :
    http://[dnsname]/[folder]/

Redirect Behavior

V Redirect all requests to exact destination (instead of relative to  destination)

Only redirect requests to content in this directory (not subdirectories)

Status code :

Found (302)

---------------------------------

In the source page, it's same thing if I add or delete the link tag to the icon.
<html>
   <head>
      <link rel="icon" type="image/x-icon" href="/favicon.ico">
   <head>
<html>

【问题讨论】:

  • 您可以使用其绝对网址访问该网站图标吗?例如http://www.yourwebsite.com/favicon.ico
  • 可以,但仅在 Http 重定向关闭时。
  • 如何设置重定向(从 - 到)?它是否保留在同一个域和/或目录中?我的猜测是所有请求都会被重定向(包括网站图标),因此网站图标可能有错误的 url。你检查页面的源代码了吗?
  • 好的。它在 IIS 6.0 中运行得非常好!另一个奇怪的事情是,wwwroot 文件夹中的图标预览始终是同一个,即使我更改了图标...在 windows server 2003 中工作。
  • 我仍然没有 100% 得到它,但我认为对您网站根目录的所有请求都会被重定向(包括网站图标)。您需要在 IIS 中进行重定向吗?你不能只放置一个javascript重定向吗? window.location.href = '新网址'

标签: iis favicon http-redirect


【解决方案1】:

好的,我找到了解决方案。只需将以下代码放在 wwwroot 目录下的 web.config 中即可。

<configuration>
    <location path="favicon.ico">
        <system.webServer>
            <httpRedirect enabled="false" />
        </system.webServer>
    </location>
</configuration>

感谢 Mirko Lugano 的帮助,让我走上了正轨!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-07-29
    • 2015-08-12
    • 2015-03-13
    • 2017-04-17
    • 2023-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多