如何阻止Google搜索链接到https?

时间:2016-07-24 20:28:14

标签: ruby-on-rails ssl heroku dns search-engine

当我通过Google搜索结果找到我的网站时,它正在使用:

https://www.example.com

由于我还没有有效的SSL证书,浏览器中会出现警告 -

"Your connection is not private"

我希望Google使用http://example.com而不是https链接到我的网站。我的其他非SSL网络应用程序没有此问题。

我可以采取哪些措施来解决这个问题?

1 个答案:

答案 0 :(得分:1)

仔细检查您是否强制在设置中使用SSL

#config/environments/production.rb
# If this is set to true, change it to false
config.force_ssl = false

另外,请确保您没有使用https://连接链接到任何外部资源,而是使用协议中性//。请参阅我在使用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'