当我通过 Google 搜索结果找到我的网站时,它正在使用:
https://www.example.com
由于我还没有有效的 SSL 证书,浏览器中会出现一条警告 --
"Your connection is not private"
我希望 Google 使用 http://example.com
而不是 https
链接到我的网站。我的其他非 SSL 网络应用没有这个问题。
我可以采取什么步骤来解决这个问题?
最佳答案
仔细检查您没有在设置中强制使用 SSL
#config/environments/production.rb
# If this is set to true, change it to false
config.force_ssl = false
还要确保您没有使用 https://连接链接到任何外部资源,而是使用协议(protocol)中立的//代替。在我的一个使用 DataTables 的应用程序中查看此片段中的 stylesheet_link_tag 行和注释堆栈溢出问题
# views/layouts/application.html.haml
-# Include DataTables stylesheets
-# http://datatables.net
-# BUGFIX
-# Note the lack of a http: protocol definition to prevent force_ssl config setting
-# from preventing content loading
-# http://stackoverflow.com/questions/18121258/the-page-at-url-ran-insecure-content-from-url-in-chrome
= stylesheet_link_tag '//cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css'
= javascript_include_tag '//cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js'
关于ruby-on-rails - 如何阻止谷歌搜索链接到 https?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38556468/