Hello i have done a favicon.ico to put in the address bar. Although is shows locally (wampserver) when i put it online the icon doesnt appear. This is what i use:

<link href='<?php echo $base_url; ?>icons/favicon.ico' rel='icon' type='image/x-icon' />
<link href='<?php echo $base_url; ?>icons/favicon.ico' rel='shortcut icon' type='image/x-icon' />

Dani AI

Generated

Short diagnostic and focused steps to isolate the problem (based on the thread): the ICO displays locally but visiting yourdomain.com/favicon.ico reports a corrupt image, which means the bytes delivered by the server are not the same as the working local file or the server is returning non-image content. , , and pointed to the right areas (location, regeneration, cache, re-upload)—the missing step is verifying what the server actually serves and comparing bytes.

Testing / inspection (quick):

curl -I https://yourdomain.com/favicon.ico
curl -L -o favicon_download.ico https://yourdomain.com/favicon.ico
file favicon_download.ico

If the first command shows a Content-Type: text/html or a redirect, the request is returning an HTML/error page (not an ICO). If file reports HTML, zero bytes, or a different image type, the server copy is wrong. A valid ICO header starts with the bytes 00 00 01 00 (check with a hex viewer if needed).

Common causes and targeted fixes

  • Binary corruption during upload: some FTP clients default to ASCII; force binary or use SFTP/host file manager and re-upload.
  • Wrong file format: recreate the .ico using a trusted generator, ensuring it contains the usual favicon sizes (16x16/32x32) and is actually an ICO (not a PNG renamed).
  • Server/CMS rewrite or CDN: some hosts or CMS/plugins intercept /favicon.ico and return a stub or cached asset; check .htaccess, CMS settings and any CDN cache.
  • MIME/permissions: ensure .ico is served as image/x-icon and file permissions allow public read (e.g., 644).

Final checklist

  1. Confirm downloaded bytes match local file. 2) Re-upload in binary/SFTP. 3) Clear server/CDN and browser cache. 4) If logo.ico works but favicon.ico doesn't, inspect server rules that specifically handle /favicon.ico. If still failing, supply the host with both the good local file and the bad server copy for comparison.

Recommended Answers

All 12 Replies

In HTML5, you don't need type="".
Also, it's recommended to put your favicon in your base directory (/) as browsers automatically call at /favicon.ico — so that might save some headaches.

Best of luck.

i ll try it. thanks

still the same. the icon doesnt appear. Changed the directory but still the same

i am gettings an error: the image can't be shown because it contains errors. Anybody knows why is that?

Member Avatar for Member #120589
<link rel="icon" href="favicon.ico">

Should work. Have you cleared the cache on your browser?

Maybe your .ico file is corrupt. Go to yourdomain.com/favicon.ico and then see what shows up.

Yes it says that it is corrupt. What's wrong with it?

Hola,

It could be ccorrupted if it is not uploaded properly, copied properly, could be many reasons. I suggest you take the image you want to use as a favicon(i am guessing, you have it in either 16x16 or 32x32).

If not and you have a bigger image you can resize your image using photoshop, If you are not familer with photoshop, i suggest you use: the online editor:
http://apps.pixlr.com/editor/

& once you have the image with the favicon sizes i mentioned above:
you can convert the image to a favicon using this site here:
http://tools.dynamicdrive.com/favicon/

Let us know if you have any issues :)

You probably stopped uploading it half way through. Go remake the favicon and upload it.

its not that. The name used to be logo.ico. When i use yourdomain.com/logo.ico the icon appears as icon but not in the address bar as wanted. If i change the name to favicon the icon doesnt appear either on the yourdomain.com/favicon.ico or the address. It says that it is corrupt

Then I would still re-upload from scratch, as this should fix that.

Maybe in the renaming process your server has a problem and didn't quite finish it or something. Either way, an upload will DEFINATELY reset everything, and solving your problem.

Man that it is so upsetting. i cant believe i am spending hours and still have nt figured it out... i have upload it ten times

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.