问题
We are in the process of moving a Ruby On Rails website from HTTP to HTTPS. Our sites uses the fb-comments
plugin to capture user comments on various pages. During our testing we found when we switch a page from HTTP to HTTPS Facebook seems to see this as a new page and no longer loads any of the previous comments for the page.
In other words, http://my.domain.com/page1
and https://my.domain.com/page1
are treated as separate pages with different sets of comments by fb-comments
.
Here's a snippet of our HTML that includes the current call to fb-comments
:
<div class="fb-comments"
data-href="<%=url_for(:only_path=>false)%>"
data-num-posts="<%=number_of_posts%>"
data-width="<%=width%>">
</div>
Does any know the correct way to get Facebook to return the comments for the page regardless of the protocol (HTTP vs. HTTPS)?
回答1:
The only way to keep the comments afaik is to use the http URL in the data-href parameter. I don´t think there are any downsides to this.
回答2:
According to my testing you need to remove 'http://' and 'https://' from fb-comments, so I use this block:
<div class="fb-comments" data-href="www.mydomain.com/page1.html"></div>
来源:https://stackoverflow.com/questions/30056273/how-to-best-move-fb-comments-from-http-to-https