Favicon Content-Type: text / plain - "AddType image / ico.ico" does not work

I asked my developer to set the expiration date of the icon by adding the following line to the .htaccess file:

<IfModule mod_expires.c> ExpiresByType image/ico "access plus 1 years" 

But he didn’t have an expiration date, he couldn’t understand until I loaded the icon in Firefox and noticed this part of the response headers

 Content-Type: text/plain; charset=WINDOWS-1251 

Then I was asked to add the following: (so that Apache sets the correct mime type for the icon)

 <IfModule mod_mime.c> AddType image/ico .ico </IfModule> 

But he did not do this trick, not sure why, can there be a conflict that cancels mod_mime.c? or for any other reason?

Please inform

thanks

Added: I have this to set the expiration date:

 <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/gif "access plus 1 years" ExpiresByType image/jpeg "access plus 1 years" ExpiresByType image/png "access plus 1 years" ExpiresByType image/x-icon "access plus 1 years" ExpiresByType text/css "access plus 1 years" ExpiresByType text/javascript "access plus 1 years" ExpiresByType application/x-javascript "access plus 1 years" ExpiresByType application/x-shockwave-flash "access plus 1 years" </IfModule> 
+4
source share
1 answer

Instead, you can try adding the following to your .htaccess file.

 <IfModule mod_header.c> <FilesMatch "\.ico$"> # cache .ico files for 1 year(31536000 sec) Header set Cache-control max-age=31536000 </FilesMatch> </IfModule> 

EDIT:

Notice that you have

AddType image / ico .ico

You're using

ExpiresByType image / x-icon "access plus 1 year"

which could also be a problem. To solve the problem, you can go to

AddType / x-icon .ico image

0
source

Source: https://habr.com/ru/post/1382928/


All Articles