Remove Etag from favicon.ico

旧街凉风 提交于 2019-12-05 01:27:58

问题


using yslow on a project I am experiencing a "problem" I can not solve.

Yslow keeps complaining:

There is 1 component with misconfigured ETags http://www.domain.com/favicon.ico

I have the following in my .htaccess file

# Add Proper MIME-Type for Favicon
AddType image/x-icon .ico

# Enable Apache's mod_expires Module
ExpiresActive On
ExpiresByType image/x-icon "access plus 6 month"

<ifModule mod_headers.c>
  Header unset ETag
</ifModule>
FileETag None

Does anybody have an idea how to fix it?


回答1:


Add this:

ExpiresByType image/ico "access plus 1 years"

My .htaccess file:

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault A0
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/ico "access plus 1 month"
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType text/javascript "access plus 1 week"
    ExpiresByType application/javascript "access plus 1 week"
    ExpiresByType application/x-javascript "access plus 1 week"
    ExpiresByType image/x-icon "access plus 1 year"
    ExpiresByType image/ico "access plus 1 years"
</IfModule>

Header unset ETag
FileETag None



回答2:


Hmmm. this did not fix the issue for me in Drupal ( 7 ).

Adding these lines to my .htaccess file:

  ExpiresActive On
  ExpiresByType image/x-icon A604800

Also added this line to my apache http config: (but can also be in your .htaccess file)

  FileETag None

And i disabled the icon / default icon on the admin/appearance/settings/[theme_name] page.

And finally copied the favicon.ico file to my site root and this DID fix this problem for me.

Kinda looks like something is wrong in Drupal here? :/




回答3:


none above helped for me but this works excellent:

<FilesMatch "favicon.ico">
    Header unset ETag
    FileETag None
</FilesMatch>


来源:https://stackoverflow.com/questions/6197963/remove-etag-from-favicon-ico

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!