Unable to resolve the request "favicon.ico"

Hi ladies and gents,

I am constantly getting the bellow error. Can someone share if this is seen before and what I need to do to prevent it from happening or at least ideas to investigate the root cause. This is filling my logs constantly.

2011/05/23 02:26:39 [error] [exception.CHttpException.404] exception 'CHttpException' with message 'Unable to resolve the request "favicon.ico".' in /framework/web/CWebApplication.php:332

Stack trace:

#0 /framework/web/CWebApplication.php(121): CWebApplication->runController('favicon.ico')

#1 /framework/base/CApplication.php(155): CWebApplication->processRequest()

#2 domainname.com/index.php(18): CApplication->run()

#3 {main} REQUEST_URI=/favicon.ico



Are you sure that you have a file favicon.ico in your root application directory and that .htaccess is configured properly?

.htaccess should be configured to redirect to index.php only if the file or directory requested doesn’t exist.

Your browser looks for the “favicon.ico” file… you can create a file with that name of 0 bytes so that you don’t get this error anymore…

More info about favicon.ico:


Thanks for your replies. I know what favicon is I just don’t understand how come none of my other yii websites have this and its just my latest project that is picking these up so I was wondering if I’ve done smth wrong.

I think I will just create the file. If complications occure I will seek help again. Thanks again for your feedback

Firefox is paranoid with this favicon.ico, he looks for favicon at any level (even controller/view/favicon.ico).

You can manage with .htaccess, redirecting any request for favicon.ico to the correct favicon.

If using Apache, this can be added to .htaccess:

RewriteCond %{REQUEST_URI} ^/favicon.ico$

If using IIS, this is a fragment sample of what can be used in web.config:



    <rule name="Imported Rule 1" stopProcessing="true">

      <match url="^(.*)$" ignoreCase="false" />


        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />

        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />

        <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" />


      <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" />




IIS will need the URL Rewrite extension if not already installed.

The favicon and robots errors were annoying me to death, especially in the runtime/application.log file. Also these requests register false site access if I’m logging the visits.

I’ve found a very simple and effective cure. Anyway I declared the Controller’s init() method, so I’ve put a small code here.

In protected/components/controller.php:


public function init() {

	// filter out garbage requests

	$uri = Yii::app()->request->requestUri;

	if (strpos($uri, 'favicon') || strpos($uri, 'robots'))


	// do the other initialization stuff




Be careful, you must edit the above code if you have a controller or action named ‘favicon’ or ‘robots’.


I think I could use this for those annoying 'phpMyAdmin-X.X.X/scripts/setup.php’s.


No, I could not.

Such requests will end in 404 in framework code before they reach this one.

I’m having similar issue.

I have defined where my favicon.ico resides but still getting this error.

I’m using themes:

<link rel="shortcut icon" href="<?php echo  Yii::app()->theme->baseUrl; ?>/images/favicon.ico" />

And in my themes/themename/images/favicon.ico i have put the file.


Stack trace:










#3 {main}