大网数据广告活动
网站运营与故障问答

Avoid https results in Google Custom Search Engine

· 52CE 我爱测

My web requests a client certificate when you connect through https. I want the certificate pop up dialog to show only through the login screen. This is easy when all the links you see on the page are http, except from the ones p…

问题原文

原帖链接 · NotGaeL · CC BY-SA 3.0

My web requests a client certificate when you connect through https.

I want the certificate pop up dialog to show only through the login screen.

This is easy when all the links you see on the page are http, except from the ones pointing out to the login page.

Google is indexing all pages as https as the authoritative URLs, so mostly I just see https results.

How can I tell Google to stop indexing https instead of http?

How can I tell CSE to show http results instead of https?

已采纳解答

原帖链接 · Simon Hayter · CC BY-SA 3.0

Nowadays Google prefers to index HTTPS:// when given the option of both SSL and non-SSL. To avoid the HTTPS being indexed, but accessible to users you can select one of the options below.

Canonical Links

By far the best solution is to use canonical links, this will tell Google the preferred URL for both their crawler and users.

Header No Index

Sometimes using canonical links is not always practical when dealing with static websites, this problem can be easily tackled by using a noindex header response on all pages that use HTTPS://, a typical example of how to setup no index in the .htaccess file

  • Header set X-Robots-Tag noindex env=HTTPS

Redirect SSL Robots

Since Google treats SSL as a separate site, its possible to have two robot files, one for SSL, one for non-SSL, obviously in the SSL you deny access by using something like this:

RewriteCond %{HTTPS} on 
RewriteRule ^robots\.txt$ robots-ssl.txt

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-05-25)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。