如何最好地将fb-comments从http移到https [英] How to best move fb-comments from http to https
问题描述
我们正在将Ruby On Rails网站从HTTP迁移到HTTPS.我们的网站使用fb-comments
插件来捕获各个页面上的用户评论.在测试过程中,我们发现将页面从HTTP切换到HTTPS时,Facebook似乎将其视为新页面,并且不再加载该页面的任何先前注释.
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.
换句话说,fb-comments
将http://my.domain.com/page1
和https://my.domain.com/page1
视为具有不同注释集的单独页面.
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
.
这是我们HTML的摘要,其中包括对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>
有没有人知道使Facebook返回与页面无关的协议(HTTP与HTTPS)的正确方法?
Does any know the correct way to get Facebook to return the comments for the page regardless of the protocol (HTTP vs. HTTPS)?
推荐答案
根据我的测试,您需要从fb-comments中删除"http://"和"https://",因此我使用了以下代码: /p>
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>
这篇关于如何最好地将fb-comments从http移到https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!