WordPress.org

Make WordPress Core

Ticket #3426: 3426_favicon_v2.diff

File 3426_favicon_v2.diff, 984 bytes (added by robertaccettura, 12 years ago)

Another Alternate

  • wp-settings.php

     
    112112if ( !defined('WP_CONTENT_DIR') )
    113113        define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
    114114
     115// Special case for missing favicon
     116if ($_SERVER['REQUEST_URI'] == '/favicon.ico'){
     117        header('Content-Type: image/vnd.microsoft.icon');
     118        header('Pragma: public');
     119        header('Expires: ' . gmdate('D, d M Y H:i:s', time()+10800) . ' GMT');
     120        header('Cache-Control: max-age=10800'); // 3hrs
     121        header('Content-Length: ' . filesize(WP_CONTENT_DIR . '/default-favicon.ico'));
     122        readfile(WP_CONTENT_DIR . '/default-favicon.ico');
     123        exit;
     124}
     125
    115126if ( file_exists(ABSPATH . '.maintenance') && !defined('WP_INSTALLING') ) {
    116127        include(ABSPATH . '.maintenance');
    117128        // If the $upgrading timestamp is older than 10 minutes, don't die.