Automatic favicon in subdirectories and files

Recently, my friend provided me with disk space on his VPS and gave me usage http://IP/czdavid/. Currently, I do not need a domain name, as it will serve me as a file-sharing site.

Now the problem is that it has its own icon in the IP root, and browsers look for it there. I can solve the problem on separate pages using <link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/>, the problem is that the list of directories and actual files - images and text files and others open in the browser - will show the domain icon.

Is there any way to set favicon for the entire subdirectory, except to get the domain name?

+5
source share
2 answers

No, It is Immpossible.

favicon.icowill be extracted from the root of the site, if not specified in the element linkon the HTML page.

+2
source

The only way I can think of is to use the rewriting capabilities of URLs on a web server. At least in the case of apache, it would be possible to create a set of rules that would provide a different icon depending on the referrer from the request.

But this is an ugly hack and only works if browsers do send a referrer asking for an icon.

+2
source

All Articles