2

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?

2 Answers 2

3

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).

bybe multiple sites in webmaster tools
(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.
1
  • So even though I've enforced SSL on the entire site via .htaccess (every page redirects to https://example.com), I should still add http://example.com, http://www.example.com and https://www.example.com (seems like a waste of time adding and verifying all these versions) while identifying https://example.com as the preferred. Jul 8, 2016 at 13:44
2

Google Search Console (formerly known as Google Webmaster Tools) does not have a preferred protocol settings (though oddly Google Analytics does).

You should ensure you have 301 redirects to direct users and search engines to the preferred version (https://example.com) and not allow your site to be accessed in multiple ways without redirecting to the preferred method.

Adding all 4 variants of your site is recommended best practice in case a variant has issues, but with the correct redirects, only the preferred version will have any data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.