Skip to content

HTTP to HTTPS Migration Without Risking Your Search Rankings

Posted in On-Page SEO

The instructions in this post assume that a valid SSL certificate is already installed on your project site. If not yet, you can copy what I did and shared in this post. It is for you if you need a quick SSL certificate solution that costs $0 now. After that, you must 301 redirect all HTTP URLs to their secure HTTPS version URLs. This is what we would call an http to https migration.

The two main objectives of a complete HTTP to HTTPS migration are:

  1. To never again let anyone including search engine robots see a website’s less secure HTTP URLs.
  2. To make sure Google knows about the migration.

The things you need to do are the following

  1. First, redirect all less secure HTTP URLs to secure HTTPS version urls – You will need the proper 301 redirect codes for this. So, use this set of redirect codes if you need to redirect from non-www to www URLs. Simply replace “example” with your domain name:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /
    
    ## Redirect index.php
    RewriteCond %{THE_REQUEST} ^.*/index\.php
    RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
    
    ## Redirect Non-WWW to WWW
    RewriteCond %{HTTP_HOST} ^example\.com
    RewriteRule ^(.*)$ https:\/\/www\.example\.com\/$1 [R=301,L]
    
    ## Redirect HTTP to HTTPS
    RewriteCond %{HTTPS} off
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule ^(.*)$ https:\/\/www\.example\.com/$1 [R=301,L]
    

    Use this set of redirect codes if you need to redirect from www to non-www URLs. Replace “example” with your domain name.

    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /
    
    ## Redirect index.php
    RewriteCond %{THE_REQUEST} ^.*/index\.php
    RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
    
    ## Redirect WWW to Non-WWW
    RewriteCond %{HTTP_HOST} ^www\.example\.com
    RewriteRule ^(.*)$ https:\/\/example\.com\/$1 [R=301,L]
    
    ## Redirect HTTP to HTTPS
    RewriteCond %{HTTPS} off
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule ^(.*)$ https:\/\/example\.com/$1 [R=301,L]
    

    After adding these codes in your HTACCESS file, use URL 301 Redirect Checker and the CASE 2: HTTP to HTTPS checklist from this post to verify that all your redirects work as intended and expected.

  2. Next, generate a new XML sitemap that has URLs in HTTPS instead of HTTP.
  3. Then, in the robots.txt file, the HTTP URL location of your sitemap with the HTTPS URL location.
  4. Afterwards, login to your Google Analytics account and go to Admin => Account => Property => Property Settings and switch the Default URL dropdown selection from http:// to https://.

    ga-default-url

  5. And then, login to your Google Search Console account, and add your HTTPS website as a new property. Remember, you still need the existing HTTP properties of your site so do not remove them from Google Search Console.add-a-property-buttonsearch-console-add-new-propertyVerify this new HTTPS property using your favorite method for verification.
  6. And then, you’ll receive a confirmation in the Search Console dashboard messages section. It will suggest that you go to Site settings to set whether you want Google to display your URLs in the SERPs as www or non-www. And, you have to set a target country under Search Traffic => International Tagging.site-settingstarget-countryThese two settings are so easy to do.  That is why I grouped them into just one step.
  7. Your next big step is to Submit the new sitemap containing only the HTTPS URLs which you generated to complete Step 2. Go to Crawl => Sitemaps tab and click the ADD/TEST SITEMAP button to enter the filename of your sitemap as shown in the image below as sitemap.xml. Then, click Submit. add-test-sitemap
  8. Then, click the Crawl => Fetch As Google tab from the left menu. Next, click the Fetch button for Desktop and Mobile: Smartphone then click the Submit to index buttons.fetch-as-google
  9. Next, click the Crawl => robots.txt Tester tab. Then, click the Submit button. A popup window will open where you have to click the 3rd button (another submit button) to “Ask Google to Update” your robots.txt record in Google Search Console. Simply skip this step if you see that it has already update since you’ve completed Step 3.update-robots-txt
  10. Finally, associate your website’s HTTPS property in Google Search Console with your website’s Google Analytics account profile. Then again, go back to Google Analytics Admin => Account => Property => Property Settings and scroll down to the bottom where you’ll click the Adjust Search Console button. Then, scroll up to click the edit link beside your site’s HTTPS web address under Search Console Settings.adjust-search-consolesearch-console-settings-editA new page will open showing you the list of all the verified properties in Google Search Console. Then, tick the radio button beside the HTTPS property and click Save. You will receive a confirmation under messages in Google Search Console.

That’s it!

So, now you have completed your http to https migration in just 10 steps and Google knows about it.

Additionally, to make these 10 steps a powerful SEO task I recommend putting them in a spreadsheet or you can simply download mine from this page. You can thank me later after you’ve made it easy to migrate a series of sites from HTTP to HTTPS without any issues.

Be First to Comment

Leave a comment