Favicon.ico rule possible?

i was wondering if its possible to set some kind of rule maybe in .htaccess ? so that if a browser tries to load the default /favicon.ico that it can instead serve my /images/favicon-mushroom-48.png file instead and would the browser accept it ?

i have a link to it in my index so it displays correctly but if someone clicks on an image in my gallery then its just an image display without html so the browser tries to load the default /favicon.ico and is why i was thinking of some kind of redirect rule

thanks

I do not think such a .htaccess rule or code exists. But advanced html configuration could be more easy…

2 Likes

@jaikrishna.t sorry I just edited my post while you were typing your reply

this is a case where there is no html (see my edited post)

sorry for that :frowning:

Sorry, I dont know of any such rule. I think you can try asking this on stackoverflow.com as more techies are there.

2 Likes

good tip thanks i’ll check em out :smiley:

1 Like

Why not just use a 302 redirect in your .htaccess?

3 Likes

that sounds interesting, thanks @wackyblackie

im stupid and thought the 301 302 redirect were only for webpages :face_with_diagonal_mouth:

gonna try it now, i hope my website doesnt explode !

3 Likes

well that broke it for sure, i knew something would explode !

Redirect 302 /favicon.ico /images/favicon-mushroom-48.png

Interesting, because doing that has worked for me before. Notice the 503 status code, maybe try again in like 5 minutes.
Also, why does the favicon-48.png redirect to itself (302)?

2 Likes

oh its kind of working, showing the correct icon now just showing in insecure connection warning

i’ll give the full url including https:// and see what happens

hmmm that didnt help :frowning: not sure what to do now as I cant see and errors

@wackyblackie oh yeah i didnt notice that redirect to itself, very odd

now i dont see any network stuff at all lol

im mostly clueless with this stuff sorry

now my website is broken :frowning:
i commented out the rule in .htaccess but still getting insecure message which never happened before :frowning:

  1. In the “Network” tab, fix this (click All or Images):
    image
  2. Can you share the contents of your .htaccess?
1 Like

ok I just noticed this

Cookie “__test” will be soon treated as cross-site cookie against “https://lovebyte.eu.org/images/favicon-mushroom-48.png” because the scheme does not match.

why is there a cross-site cookie warning against favicon-musroom-48.png ?

somehow ive broken something and after removing the rule from .htacess its still broken

im so annoyed with myself as ive only just got the site working after all that ep overload madness :frowning:

@wackyblackie well I dont know whats going on as now it seems to be working again, maybe it just took time ?

# redirect /favicon.ico to /images/favicon-mushroom-48.png (i hope, please dont explode)

# disabled for now seems to break the website !
#Redirect 302 /favicon.ico https://lovebyte.eu.org/images/favicon-mushroom-48.png


# php stuff

php_value display_errors Off
php_value mbstring.http_input auto
php_value date.timezone Europe/London


# custom error documents

ErrorDocument 400 /?page=error400
ErrorDocument 401 /?page=error401
ErrorDocument 403 /?page=error403
ErrorDocument 404 /?page=error404
ErrorDocument 500 /?page=error500
ErrorDocument 503 /?page=error503


# set file display order

IndexOptions FancyIndexing
IndexOrderDefault Ascending Name


# custom text file types

AddType text/plain asm
AddType text/plain c
AddType text/plain map
AddType text/plain trace

thanks :smiley:

Your .htaccess looks fine, but maybe you might want to consider adding a HTTPS redirect.

Another solution is to copy the /images/favicon-mushroom-48.png file to /favicon.ico. I did that for one of my sites and it worked.

6 Likes

oh I didnt realise the brower would load a .png that was renamed to .ico

DOH!

gonna try that now lol

thanks @wackyblackie

2 Likes

yeah that works :rofl: so simple a solution

2 Likes

thanks again to everyone for their help :+1: :+1: :+1: :+1: :+1:

1 Like