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

Google Webmaster Tools- Do I need to mark my SSL domain as a duplicate of my non-SSL domain?

· 52CE 我爱测

I have a Drupal 7 site served exclusively using SSL with the "bare" domain (no www). But, I see that in Google Webmaster Tools, I can add the following: http://example.com http://www.example.com https://example.com https://www.ex…

问题原文

原帖链接 · Patrick Kenny · CC BY-SA 3.0

I have a Drupal 7 site served exclusively using SSL with the "bare" domain (no www).

But, I see that in Google Webmaster Tools, I can add the following:

  • http://example.com
  • http://www.example.com
  • https://example.com
  • https://www.example.com

I have added all of these for my site, accessed Site settings, and set it to Display URLs as example.com.

This is true for the example.com + www.example.com pair and the https://example.com + https://www.example.com pair. Do I need to do anything more to mark my https sites as duplicates of the non-https sites?

已采纳解答

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

SOURCE

Add all variations of your site to WMT

While the site address move tool may not treat protocols, url changes and sub domains as new sites, the rest of Webmaster Tools does treat protocols and sub domains as separate sites. You should add all variations of your site, below is an example of my site BYBE added to WMT with all variations, you should do the same. (recommended by John Mueller from Google, See comments below this answer).


(source: bybe.net)

301 redirects recommended by Google

If you plan to serve the website as partial ssl or complete then you should setup good redirects, as recommended by Google:

SOURCE

Prepare for 301 redirects Once you have a mapping and your new site is ready, the next step is to set up HTTP 301 redirects on your server from the old URLs to the new URLs as you indicated in your mapping. Keep in mind the following:

  • Use HTTP 301 redirects. Although Googlebot supports several kinds of redirects, we recommend you use HTTP 301 redirects if possible.
  • Avoid chaining redirects. While Googlebot and browsers can follow a "chain" of multiple redirects (e.g., Page 1 > Page 2 > Page 3), we advise redirecting to the final destination. If this is not possible, keep the number of redirects in the chain low, ideally no more than 3 and fewer than 5. Chaining redirects adds latency for users, and not all browsers support long redirect chains.
  • Test the redirects. You can use Fetch as Google for testing individual URLs or command line tools or scripts to test large numbers or URLs.

Setting up the redirect in Apache

Setting up redirects in Apache, ngInx, IIS is pretty straight forward, below is examples of redirecting 301 from HTTP to HTTPS in Apache2 .htaccess file.

SOURCE

Enforce SSL on specific pages and disable on rest

This script will remove SSL on all other pages part from the login page and register page, you can add more just use | as the separator between file names.

mod_rewrite:

RewriteCond %{HTTPS} on
RewriteCond %{SCRIPT_FILENAME} !\/(login|register)\.php [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

Enforce SSL on the entire site

If you want to enforce SSL on the complete site then you can use mod_rewrite to detect HTTPS off.

mod_rewrite:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Sitemap changes

Since you are changing protocol you need to add a new property to Google as HTTPs, this will have no sitemap submitted as default, you will need to ensure that your sitemap contains all the new URLS and then submit it under the HTTPS property variation.

You should also inform Google your preferred domain (variation):

SOURCE

Specify a preferred domain:

  • On the Search Console Home page, click the site you want.
  • Click the gear icon , and then click Site Settings.
  • In the Preferred domain section, select the option you want.

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

资料来源与适用范围

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

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

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