问题
I put my favicon.ico in my public folder, and it shows up on my localhost, but when I check it out on the internet,
shows up instead. My app is hosted through heroku, and the domain is provided by hover. Where is this failing?
Also, in case this helps, here is the code I'm using to render the favicon:
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="/favicon.ico" />
<title>Shoulak Predictions</title>
<%= stylesheet_link_tag 'application', media: 'all' %>
<%= javascript_include_tag 'application' %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<div class="container">
<% flash.each do |key, value| %>
<div class="alert alert-<%= key %>"><%= value %></div>
<% end %>
<%= yield %>
</div>
<div class="container">
<%= render 'layouts/footer' %>
<%= debug(params) if Rails.env.development? %>
</div>
</body>
</html>
Update
If I go to mydomain.com/favicon.ico, I do download the favicon that I uploaded. ALSO, if I go to therealapp.herokuapps.com, it shows up. I think somehow my domain provider may be providing their own?
回答1:
Adding a random number in your favicon will force the update:
<link rel="shortcut icon" href="/favicon.ico?v=2" />
回答2:
Once I cleared my browser cache, the favicon showed up.
回答3:
I've found that it takes time for that change to show up. Something to do with browser caches or server settings or something.
回答4:
I was doing Hover forwarding, not using the DNS features. Hover automatically uses their own favicon.
来源:https://stackoverflow.com/questions/15562173/favicon-shows-up-on-rails-local-not-on-hosted-app