[pmwiki-users] Handling Favorites-Icon Requests

Patrick R. Michaud pmichaud at pobox.com
Tue Jan 17 17:12:51 CST 2006


On Tue, Jan 17, 2006 at 02:13:09PM -0700, H. Fox wrote:
> I just installed the (excellent) TotalCounter recipe and discovered my
> site is getting a lot of requests for {$Group}.favicon.ico.  PmWiki
> redirects these requests to a non-existent Favicon.Ico page.

I'm not sure why you'd be getting those requests -- I just checked
my logs on pmwiki.org and the *only* requests I'm getting for 
{$Group}/favicon.ico are coming from a redirect of pmwiki.de .
All of the other favicon.ico requests are in the root or in
the /pmwiki/pub/skins/ directory.

At any rate, I'm curious as to the source of your favicon.ico
requests, as I'm not seeing them on pmwiki.org .

>    if (the request is for a favorites icon) {
>      do something appropriate instead of redirecting.
>    }
> I suppose the most appropriate default behavior would be return a 404 error.

if (preg_match('/favicon\\.ico$/', $pagename)) {
  header("HTTP/1.1 404 Not Found");
  print "<h1>Not Found</h1>";
  exit();
}

> (Maybe, as a recipe, a favorites icon could be returned.)

if (preg_match('/favicon\\.ico$/', $pagename)) {
  header("Content-type: image/x-icon");
  readfile("/path/to/favicon.ico");
  exit();
}

Pm




More information about the pmwiki-users mailing list