December 11, 2016 · admin

How to Add Https to a WordPress Website

Implementing HTTPS for WordPress

Want to Have Your Website SSL Encrypted?

You have decided to secure your WordPress website by adding an SSL encryption. Maybe you are required to, or your competitors do and you follow, and maybe you think it is good to do it because Google has started preferring secure sites in search. We will show you five simple steps of how to achieve that your homepage and all your sub pages are served via https protocol:

  1. Install SSL Certificate
  2. Change your website URL
  3. Remove mixed content
  4. Replace all remaining mentions in database
  5. Force HTTPS

Five Steps Explained: Make Your Site Run as HTTPS

[info_list icon_bg_color=”#ef4836″ icon_color=”#ffffff” font_size_icon=”15″][info_list_item list_title=”Installing SSL Certificate” list_icon=”Defaults-chevron-right”]Firstly, you need to purchase and install an SSL certificate on your web server. Some of the webhosting companies already provide you a free SSL certificate, so you do not have to pay for it. The two most used free of charge SSL certificate are offered by Cloudflare and Let’s Encrypt. Or you can purchase it, the prices vary from approx. $50 to $300.[/info_list_item][info_list_item list_title=”Changing Website URL” list_icon=”Defaults-chevron-right”]Secondly, go to the FTP of your website and open a wp-config.php file. It is located in the main folder of your website. Here, we need to change two strings – replace http for https here. Look for these two lines:

define(‘WP_SITEURL’,’http://www.’ . ($_SERVER[‘HTTP_X_WP_TEMPORARY’] ? $_SERVER[‘HTTP_X_WP_TEMPORARY’] : yourwebsiteurl.com.au’));

define(‘WP_HOME’, ‘http://www.’ . ($_SERVER[‘HTTP_X_WP_TEMPORARY’] ? $_SERVER[‘HTTP_X_WP_TEMPORARY’] : yourwebsiteurl.com.au’));

Here, change the two “http” occurrences for “https”, save and replace the file. Now, your website will start running with https:// at the beginning. You should be able to access WordPress admin via https as well.[/info_list_item][info_list_item list_title=”Fixing Mixed Content Issues” list_icon=”Defaults-chevron-right”]Third step is fixing serving of mixed content. What happens usually is, that your website will server so called mixed content. Thus, the it will not be identified as secure in modern web browsers and they will display warning for your visitors. This is caused by WordPress serving some of the resources, typically images, via http. To fix this, please remove any caching mechanism you have on your website, so deactivate plugins such as W3 Total Cache, Fastest Cache and similar, turn of the caching via .htaccess if you have one and turn of http caching on your webserver. You can install a HTTP / HTTPS Remover plugin which should care for removing the mixed content. Now try loading the pages that were serving mixed content. If the problem remains, try the Https Switcher plugin. You probably do not need both of these plugins or neither of them, if you need to proceed to step four and you successfully accomplish it.[/info_list_item][info_list_item list_title=”Changes in Database” list_icon=”Defaults-chevron-right”]In the fourth step, if none of these plugins solved the problem completely (they typically solve the most issues), we will use a plugin Better Search Replace to replace all remaining http:// mentions in your database for those with https. Before proceeding, make a backup of your database. If you are not sure how to do it, I recommend the Updraftplus plugin, which is easy to install and make your first backup. Save the backup to your local computer or upload it to a remote storage with Updraftplus so your backup is easily accessible for you. Now go to the Better search and replace plugin. You will find it under Tools in WordPress menu. Here, enter “http://” into the Search for field and “https://” into Replace for field. Select all the tables in your database and run a dry run. Usually, dozens or hundreds of cells are identified that need updating. Now you can run the real replace.[/info_list_item][info_list_item list_title=”Forcing All Pages to Load Via HTTPS” list_icon=”Defaults-chevron-right”]This should fix all the issues and now if you type any of your URLs with https:// at the beginning, all content should be serve as https and all browsers should recognise your website as being secure and display the information about your certificate and encryption used. However, now your web pages are accessible via https and http as well. To redirect all your http versions to https, you can add a few lines to your .htaccess file. So we need to fix this in the fifth step. There are many articles and discussion forums out there, but most of them will not work. So, I recommend using a plugin again. Install and activate the WP Force SSL plugin. There are no settings needed for it and immediately after activating, all your http:// versions will be redirected to encrypted version of your website.[/info_list_item][/info_list]

You Made It – Your Site Runs as HTTPS Now

And that is it, congratulations, you have made it to the end! Now you can turn on caching again. You can try deactivating plugins used in step 3, you should not need them any more. You can even skip step 3 if you are comfortable with step 4. Step 3 is the easier way for most WordPress users and usually, step 4 is not necessary in most cases.

How to configure HTTPS for WordPress site - Website secured sign in Google Chrome
Picture 1: This icon will be displayed if all content is served through https. If not, a “i” icon will be displayed warning the users that the site is not or just partially encrypted. Click on the sign and then select Details to learn more about the problem.
How to configure HTTPS for WordPress site - Detailed information on security
Picture 2: Detailed information on webpage security. The third paragraph will contain a link to track all resources loading through http in case mixed content will be identified.
How to configure HTTPS for WordPress site - Replacing values in database with better search replace plugin
Picture 3: Making changes to your database with Better Search Replace plugin

We'd love to hear from you

If anything described in this article did not work for you or you have any other questions, add a comment to this article and we will try to help. You can also provide us with your website details and describe your issues via the enclosed contact form. We are happy to get in touch and help you with any web design and/or digital marketing issues you might have.

[gravityform id=”1″ title=”false” description=”false” ajax=”true”]

Work with us

Want results like this?

Book a free strategy call. We’ll look at where you stand on Google and in AI search — and tell you honestly whether we can help.

  • Founder-led — you speak with Dr Andrej Miklosik
  • Response within one business day
  • No obligation, no hard sell

Prefer to talk? 0432 055 562

Free strategy call

Tell us about your business

Your details stay with us. We don't share them or add you to a marketing list without asking.