Favicon for all the pages in my website

前端 未结 4 1825
轻奢々
轻奢々 2021-02-18 21:32

I\'ve learned that the way to add favicon for a web page is to have the following lines in the page.



        
相关标签:
4条回答
  • 2021-02-18 22:01

    Modify the apache config.

    upload this file to the root directory of your website. For some reason the execute bit has to be set on this file for apache to use it. If you have shell access, type: "chmod +rx favicon.ico".

    Then edit httpd.conf and insert the following line:

    "AddType image/x-icon .ico"

    Your approach works when you don't have access to your apache config. In this case, if you are using any framework then you should add it to your layout/template.

    0 讨论(0)
  • 2021-02-18 22:04

    You can get rid of the unnecessary processing and traffic as well as the error log entries by using the following Apache configuration incantations:

    # Don't bother looking for favicon.ico
    Redirect 404 /favicon.ico
    
    # Send custom text instead of sending the custom error page
    <Location /favicon.ico>
        ErrorDocument 404 "No favicon"
    </Location>
    
    0 讨论(0)
  • 2021-02-18 22:09

    It is usually enough to place a file called "favicon.ico" in the root of your website.

    0 讨论(0)
  • 2021-02-18 22:25

    Here is my method for php sites. It ensures that if you update the favicon, it will be updated immediatly when your clients visit your site:

    <link rel="shortcut icon" href="favicon.ico?v=<?php echo time() ?>" />
    
    0 讨论(0)
提交回复
热议问题