How to replace all "http" hyperlink with "https" Drupal

Recently I made a switch from http to https. I was pretty pleased with results, and started to wait for possible SEO boost from Google. As time passed, instead of boost some traffic drop started to appear in my Google Analytics account.

I cannot say for sure is this because of https thing or some major update in Google Search algorithm (Penguins & Pandas) , I just wanted make sure everything works right on my site.

Traffic dropped to 0 (hourly view)

Traffic dropped to 0 (hourly view)

Most probably it is just some glitch in Google Analytics (it happens time after time), or my server was not accessible, but maybe it was some Google Algorithm update. I'm not sure what was that, but that was the reason to get rid of Mixed content on my site and fix this ASAP.

Since I have a pretty large website with tons of photos uploaded (I'm using both Drupal file upload, both inline uploading images using CKEDITOR) - I started to notice that on some (on most,actually) articles a Mixed Content warning appeared and instead of browser bar turning green it stayed gray, at least for Google Chrome.

What is Mixed content

This basically means following your site is serving resources (images, for example) both over http and https. Here is good explanation about mixed content from Mozilla

However, if the HTTPS page you visit includes HTTP content, the HTTP portion can be read or modified by attackers, even though the main page is served over HTTPS. When an HTTPS page has HTTP content, we call that content “mixed”. The page you are visiting is only partially encrypted and even though it appears to be secure, it isn't

The more I'm reading on Mozilla, the more I'm assured I must fix this mixed content as soon as possible:

An attacker can replace the HTTP content on the page you're visiting in order to steal your credentials, take over your account, acquire sensitive data about you, or attempt to install malware on your computer. 

Solution for Drupal

At start I manually updated articles which included images (It was fun actually, many of articles were bad written or out dated, so I had chance to update them), but in the last two and a half years I have written more than 400 articles with images, and some of the articles feature as many as 136 pictures. It would be a very time consuming task - to manually update all http paths to https version.

I wanted to write a simple update query and run it on phpmyadmin to replace all http://reinisfischer.com to https://reinisfischer.com, but before I proceeded I did found and excellent Drupal module Pathologic:

Pathologic is an input filter which can correct paths in links and images in your Drupal content in situations which would otherwise cause them to “break;” for example, if the URL of the site changes, or the content was moved to a different server.

With help of Pathologic module it took mw some 10 minutes to get rid of all mixed content warnings. From admin/config/content/pathologic I checked Protocol relative URL (//example.com/foo/bar)

General settings for Pathologic moduke

General settings for Pathologic module

Nest from Text Editor settings page I enabled Correct URLs with Pathologic for all my text editors (I had two)

Enabling Pahtologic for Text formats

Enabling Pahtologic for Text formats

After clearing cache all my content was served over https. The Pathologic module is a true time saver and set and forget module.

Add new comment