UnB*_*oug 2 iis favicon http-redirect
你好!
问题是,当 IIS 8.5 中的 http 重定向处于活动状态时,网站图标不会出现。我的操作系统是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>
Run Code Online (Sandbox Code Playgroud)
好吧,我找到了解决方案。只需将以下代码放入 wwwroot 目录中的 web.config 中即可。
<configuration>
<location path="favicon.ico">
<system.webServer>
<httpRedirect enabled="false" />
</system.webServer>
</location>
</configuration>
Run Code Online (Sandbox Code Playgroud)
感谢 Mirko Lugano 的帮助,让我走上了正轨!