How to Properly Move WordPress from HTTP to HTTPS (Beginner’s Guide)

Are you searching to move WordPress from HTTP to HTTPS and install an SSL certificate on your website? In this article, we will discuss how to properly move WordPress from HTTP to HTTPS by adding an SSL certificate.

 

      

 

Don’t worry, if you have no idea what SSL or HTTPS is. We’re going to explain that as well.

 

What is HTTPS?

 

HTTPS or Secure HTTP is an encryption method that secures the connection between users’ browsers and your server. This makes it harder for hackers to eavesdrop on the connection.

Every day we share our personal information with different websites whether it’s making a purchase or simply logging in.

In order to protect the data transfer, a secure connection needs to be created.

That’s when SSL and HTTPS come in.

Each site is issued a unique SSL certificate for identification purposes. If a server is pretending to be on HTTPS, and its certificate doesn’t match, then most modern browsers will warn the user from connecting to the website.

 

       

 

Now you are maybe wondering, why do I need to move my WordPress site from HTTP to HTTPS especially if it’s a simple blog or small business website that doesn’t collect any payments.

 

Why do you need HTTPS and SSL?

 

Last year Google announced a plan to improve overall web security by encouraging website owners to make the switch from HTTP to HTTPS. As part of this plan, their popular Chrome web browser would mark all websites without an SSL certificate as “Not Secure”

 

      

 

As part of the announcement, Google also said that websites with SSL will also see SEO benefits and higher rankings. Since last year, a large number of websites have switched from HTTP to HTTPS.

Google has been slowly rolling out the “Not Secure” warning in Chrome. For instance, if someone visits an HTTP website using the incognito window, it will be marked as Not Secure.

If someone visits an HTTP website on regular mode and tries to fill out a contact form or another form, then the website will be marked as insecure.

When your readers and customers see this notice, it gives them a bad impression of your business.

This is why all websites need to move from HTTP to HTTPS and install SSL immediately.

Not to mention, if you want to accept payments online on your eCommerce website, then you need SSL.

Most payment companies like Stripe, PayPal Pro, Authorize.net, etc will require you to have a secure connection before accepting payments.

We use SSL for our websites including WPBeginner, OptinMonster, WPForms, and MonsterInsights.

 

Requirements for using HTTPS/SSL on a WordPress Site

 

The requirements for using SSL in WordPress are not very high. All you need to do is purchase an SSL certificate, and you might already have it for free.

The best WordPress hosting companies are offering free SSL certificates for all their users.

For more details, see our guide on how to get a free SSL certificate for your WordPress website.

If your hosting company does not offer a free SSL certificate, then you’ll need to purchase an SSL certificate.

We recommend using Domain.com because they offer the best SSL deal for both regular and wildcard SSL certificates.

By purchasing an SSL certificate from them, you also get a TrustLogo site seal for your website, and each SSL certificate comes with a minimum of $10,000 security warranty.

Once you have purchased an SSL certificate, you will need to ask your hosting provider to install it for you.

 

Setting up WordPress to Use SSL and HTTPS

 

After you have enabled SSL certificate on your domain name, you will need to set up WordPress to use SSL and HTTPS protocols on your website.

We will show you two ways to do that, and you can select one that best fits your need.

 

Method 1: Setup SSL/HTTPS in WordPress Using a Plugin

 

This method is easier and is recommended for beginners.

First, you need to install and activate the Really Simple SSL plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

Upon activation, you need to visit the Settings » SSL page. The plugin will automatically detect your SSL certificate, and it will set up your WordPress site to use HTTPS.

 

      

 

The plugin will take care of everything including the mixed content errors. Here’s what the plugin does behind the scenes:

 

  • Check SSL certificate
  • Set WordPress to use HTTPS in URLs
  • Set up redirects from HTTP to HTTPS
  • Look for URLs in your content still loading from insecure HTTP sources and attempt to fix them.

 

Note: The plugin attempts to fix mixed content errors by using the output buffering technique. It can have a negative performance impact because it’s replacing content on the site as the page is being loaded. This impact is only seen on first-page load, and it should be minimal if you are using a caching plugin.

While the plugin says you can keep SSL and safely deactivate the plugin, it’s not 100% true. You will have to leave the plugin active at all times because deactivating the plugin will bring back mixed content errors.

 

Method 2: Setup SSL/HTTPS in WordPress Manually

 

This method requires you to troubleshoot issues manually and edit WordPress files. However, this is a permanent and more performance-optimized solution. This is what we’re using on WPBeginner.

If you find this method difficult, then you can hire a WordPress developer or use the first method instead.

As part of this method, you may need to edit the WordPress theme and code files. If you haven’t done this before, then see our guide on how to copy and paste code snippets in WordPress.

First, you need to visit the Settings » General page. From here you need to update your WordPress and site URL address fields by replacing HTTP with HTTPS.

 

       

 

Don’t forget to click on the ‘Save changes’ button to store your settings.

Once the settings are saved, WordPress will log you out, and you will be asked to re-login.

Next, you need to set up WordPress redirects from HTTP to HTTPS by adding the following code to your .htaccess file.

 

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

 

If you are on nginx servers (most users are not), then you would need to add the following code to redirect from HTTP to HTTPS in your configuration file:

 

server {
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}

 

Don’t forget to replace example.com with your own domain name.

By following these steps, you will avoid the WordPress HTTPS not working error because WordPress will now load your entire website using HTTPS.

If you want to force SSL and HTTPS on your WordPress admin area or login pages, then you need to configure SSL in the wp-config.php file.

Simply add the following code above the “That’s all, stop editing!” line in your wp-config.php file:

 

define('FORCE_SSL_ADMIN', true);

 

This line allows WordPress to force SSL / HTTPS in the WordPress admin area. It also works on WordPress multisite networks.

Once you do this, your website is now fully set up to use SSL / HTTPS, but you will still encounter mixed content errors.

These errors are caused by sources (images, scripts, or stylesheets) that are still loading using the insecure HTTP protocol in the URLs. If that is the case, then you will not be able to see a secure padlock icon in your website’s address bar.

 

     

 

Many modern browsers will automatically block unsafe scripts and resources. You may see a padlock icon but with a notification about it in your browser’s address bar.

 

       

 

You can find out which content is served through insecure protocol by using the Inspect tool. The mixed content error will be displayed as a warning in the console with details for each mixed content item.

 

        

 

You will notice that most URLs are images, iframes, and image galleries while some are scripts and stylesheets loaded by your WordPress plugins and themes.

 

Fixing Mixed Content in WordPress Database

 

The majority of the incorrect URLs will be images, files, embeds, and other data stored in your WordPress database. Let’s fix them first.

All you need to do is find all mentions of your old website URL in the database that started with HTTP and replace it with your new website URL that starts with HTTPS.

You can easily do this by installing and activating the Better Search Replace plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

Upon activation, you need to visit the Tools » Better Search Replace page. Under the ‘Search’ field, you need to add your website URL with HTTP. After that, add your website URL with HTTPS under the ‘Replace’ field.

 

     

 

Below that, you will see all your WordPress database tables. You need to choose all of them to run a thorough check.

To end, you need to uncheck the box next to the ‘Run as dry run?’ option and then click on the ‘Run Search/Replace button.

The plugin will now search your WordPress database for URLs starting with HTTP and will replace them with secure HTTPS URLs. It may take a while depending on your WordPress database size.

 

Fixing Mixed Content Errors in WordPress Theme

 

Another common culprit causing the mixed content error is your WordPress theme. Any decent WordPress theme following WordPress coding standards will not cause this issue.
First, you will need to use your browser’s Inspect tool to find the resources and where they are loading from.

 

      

 

After that, you will need to find them in your WordPress theme and replace them with HTTPS. This will be a little difficult for most beginners, as you will not be able to see which theme files contain these URLs.

 

Fixing Mixed Content Errors Caused by Plugins

 

Some mixed content resources will be loaded by WordPress plugins. Any WordPress plugin following WordPress coding standards will not cause mixed content errors.

We don’t recommend editing WordPress plugin files. Instead, you need to reach out to the plugin author and let them know. If they do not respond or are unable to fix it, then you need to find a suitable alternate.

Note: If for some reason, you’re still encountering mixed content errors, then we recommend using the Really Simple SSL plugin temporarily, so your users are not impacted while you fix the issue on a staging website or hire a developer.

 

Submit Your HTTPS Site to Google Search Console

 

Search engines like Google consider HTTPS and HTTP as two different websites. This means you will need to let Google know that your website has moved to avoid any SEO issues.

To do that, you just need to go to your Google Search Console account and click on the ‘Add a Property button.

 

     

 

This will bring up a popup where you need to add your website’s new HTTPS address.

 

      

 

After that, Google will ask you to verify ownership of your website. There are several ways to do that, choose any method and you will instructions to verify your site.

 

      

 

Once your site is verified, Google will start showing your search console reports here.

You also need to make sure that both the HTTPS and HTTP versions are added to your Search Console.

This tells Google that you want the HTTPS version of your website to be treated as the primary version. Combined with the 301 redirects that you set up earlier, Google will transfer your search rankings to the HTTPS version of your website, and you will most likely see improvements in your search rankings.

We know that we did when switched our websites from HTTP to HTTPS.

We hope this article helped you add HTTPS and SSL in WordPress. You may also want to see our ultimate WordPress security guide with step-by-step instructions to keep your WordPress site secure.

 

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Change the WordPress Admin Username

This tutorial will explain the way to change the WordPress admin username with a simple-to-use...

How to Set Up Caching on a WordPress Website

In this article, we’ll explain the way to set up caching in WordPress using a popular plugin....

10 Ways to Optimize Your WordPress Website for Speed

You can’t afford to waste a second on the internet. Speed matters, particularly when it involves...

How to Fix the “Briefly Unavailable for Scheduled Maintenance” Error in WordPress

Is your website stuck in maintenance mode? During updates, WordPress displays a temporary notice...

How to Fix the “Are You Sure you want to do This” Error in WordPress (4 Methods)

Do you keep getting the “Are you sure you want to do this” error message while working on your...