即使检查直接URL到favicon文件,Favicon也不显示

时间:2011-12-12 17:44:39

标签: image .htaccess favicon

我有一个不会在我的网站上显示的favicon文件。 起初我认为这可能是责备,但我不确定这是否是正确的方向。

我的htaccess设置为将URL发送到index.php进行解析:

#Pass to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(css|gif|jpe?g|png|txt|xml|js|pdf|html)$ /home/username/public_html/domain.com/index.php [NC,L]

#Hotlinking
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpe?g|bmp|png|ico|css|js|pdf)$ http://domain.com [R,NC]

我有以下HTML:

<link rel="icon" href="http://domain.com/favicon.ico" />
<link rel="shortcut icon" href="http://domain.com/favicon.ico" />

当我尝试直接访问favicon.ico文件时,图像根本不会加载。当我尝试在本地打开图像文件(从我的硬盘,使用chrome或firefox)时,它会打开并显示正常。

1 个答案:

答案 0 :(得分:0)

请参阅解决方案/解决方法的评论(上文)。