Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've got lighttpd and apache working together on an app I'm building. lighty is serving out static content. However, each time a static asset is requested, I see a not found: favicon.ico message in the logs. I have added the following url rewrite:

url.rewrite-once = (
    "^/favicon.ico$" => "/assets/images/favicon.png"
)

But to no avail; still getting the message. Any ideas?

share|improve this question
add comment

3 Answers

Hi am assuming you rewrite looks a bit more like this and your trying to rewrite for multiple domains at the same time.

$HTTP["host"] =~ "^hostname.com$" {
    url.rewrite-once = (
    "^/favicon.ico$" => "/assets/images/favicon.png")
}

The only other think i can think of off the top of my head is that mod_rewrite is not enabled

server.modules = (
                  "mod_rewrite",

Your rewrite-once rule looks fine to me so i'm guessing it is not in the correct place in you conf file.

share|improve this answer
    
Hi, my rewrite rule is exactly what I pasted in the question; I'm not matching on any hostname, as only 1 hostname is associated with this server. Where would I need to put the rewrite rules? I've enabled mod_rewrite, and put the rewrite rules near other rewrite rules that are functioning properly. –  Kyle Oct 23 '09 at 13:03
add comment

If a web browser requests an .ico file, you should not turn around and serve it a .png file anyway. If favicon.ico does not exist on your server, it is proper to serve the browser a 404 error. If you want to keep these error messages out of your log files, that's a different question.

share|improve this answer
add comment

I would like to suggest a potentially simpler and possibly better solution to your situation.

Why not convert the PNG files to ICO? In fact, icotool seems to exist partially for just this purpose. The following snippet is quoted from the manual page:

icotool -c -o favicon.ico mysite_32x32.png mysite_64x64.png

There are command-line tools as well, such as ImageMagick, should you need to automate resizing of images for such a purpose.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.