[pmwiki-users] Handling Favorites-Icon Requests

H. Fox haganfox at users.sourceforge.net
Tue Jan 17 19:50:40 CST 2006


On 1/17/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> 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 .

It's hard to say what's going on.  Here's where I saw it:

http://qdig.sourceforge.net/?action=totalcounter

I added a blacklist pattern to filter the requests out, so the
favicon.ico numbers aren't climbing.

$TotalCounterBlacklist['Pages'] =
  array('/\\.favicon\\.ico$/','/^Favicon\\.Ico$/');

> >    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();
> }

Thanks!

Hagan




More information about the pmwiki-users mailing list