Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to add a favicon to my web page, but I don't quite know how. The instructions that the favicon generator gives are to upload the favicon to the root directory, and then paste the given code in the head of the HTML document. That's great and all, but I am not quite sure how to make a root directory and upload a favicon to it. A solution would be appreciated.

What I have tried:

I tried to put link rel to an ico file in the head, but that didn't work. I might have been doing it wrong.
Posted
Updated 29-May-20 8:11am
Comments
[no name] 29-May-20 18:04pm    
Thank you all. That was helpful. I got it to work.

The root directory of the website is already created. It's simply the directory the main site comes from. /

Depending on your website setup, this will map to a physical location on your web server. Find it. Add your favicon to that folder.
 
Share this answer
 
The root directory would be the directory that would contain all of your website's files.

Typically this would be called in your html within the head element
HTML
<!DOCTYPE HTML>
<html>
<head>
	<title>Page Title</title>
	<link rel="icon" type="image/x-icon"  href="/favicon.ico">
</head>
 
Share this answer
 
If the website already exists, then the root directory exists as well. The root directory is the directory which contains all files and subdirectories relative to the website. If it doesn't exist, then you have to create it, and the method depends on where you are deploying the website.

The way to upload the favicon file to it also depends on where the site is deployed. It can be as simple as a copy/paste operation in the root directory, if your site is on your local machine or local LAN, or you may have to use a transfer protocol such as ftp, for example, if the site is not hosted locally.

Finally all is left is to include the link tag in the head section.

The fact that "it didn't work" may be because you need to refresh your cache for the icon to appear. Try hitting Ctrl-F5 and see whether that fixed the issue.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900