How to Enforce SSL to Your WordPress Admin Panel Using cPanel

How to Enforce SSL to Your WordPress Admin Panel Using cPanel

In October 2017, Google has announced to show a notification of an insecure connection while opening a website in Google Chrome.

Nowadays, everyone is trying to activate an SSL certificate either using a CDN or web hosting. As you know, most of the companies are offering free SSL with all of their plans, but the problem occurs when you have an old website.

You try adding a redirect through .htaccess or use a plugin, but sometimes, the admin area and the login page of your website don’t adopt the SSL.

And I am sure; you also want to enforce SSL to your wp-admin dashboard, too. To do so, you need to use cPanel. In this article, you are going to learn the most convenient way to enforce SSL to a WordPress admin panel using the wp-config.php file.

You may be wondering if you need some coding skills or not. Well, there is nothing to fret about, all you need is copy and paste the code you see in this tutorial.

Add a Code to Your wp-config.php File

Now and then, you may need to use wp-config.php, it’s more than just a file to connect your site’s data and its database.

I hope you know, how to edit such a file from cPanel. If you wish, you can also use an FTP server. But I am going to explain the process using cPanel.

Follow the steps as shown below.

Step 1:

As usual, you need to login to your cPanel and search for the file manager icon. You may have a different web hosting, try finding under the files’ section.

How to Enforce SSL to Your WordPress Admin Panel Using cPanel

Bluehost has a blue cPanel layout, Hostinger has purple, Siteground, and Inmotionhosting also has their unique design.

But you can find the file manager in no time. Click to open, and you can see a new tab in your browser.

Step 2:

By default, cPanel opens the file manager until you haven’t done the settings to see the root directory. As you already know, the data is available in the root directory, so navigate to public_html from the left-hand sidebar.

How to Enforce SSL to Your WordPress Admin Panel Using cPanel

Step 3:

Search for the wp-config.php file and right-click to edit. You can also use the traditional Edit option from cPanel’s navigation menu. But right-click is more convenient.

How to Enforce SSL to Your WordPress Admin Panel Using cPanel

Step 4:

A popup appears if you wish to disable encoding. Well, there is nothing you should do, apart from clicking on the Edit button.

How to Enforce SSL to Your WordPress Admin Panel Using cPanel

Step 5:

You can see the codes of the wp-config.php file in a new tab. Here, you have to copy and paste the code shown below.

define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);

Click on the Save Changes button from the top-right corner of the screen to save the file. Clear the browser cache and cookies, check your wp-admin panel and you can see an SSL certificate enabled everywhere.

Congrats, your website is running on HTTPS.

Note: Enforcing of SSL on wp-admin is require only after activating an SSL plugin or making a redirect.

As I have already mentioned, sometimes, the WordPress admin panel doesn’t fetch the SSL certificate correctly. It needs an extra push.

I Hope You Can Solve Your SSL Issue Through This Article

Having such an issue is strange, not everyone gets it. When you use a third-party SSL certificate, the WordPress admin panel may not respond as well as all the other blogs posts and pages of your website.

So, it’s better you use the built-in SSL your web hosting company is offering. Many companies are using Let’s Encrypt.

Conclusion

Enabling an SSL certificate enhances the SEO score of a WordPress site, and I am sure, you can fix any issue with the wp-admin panel.

The code can help you enforce SSL to your admin area. I hope you can accomplish your task.

Check out these top 3 cPanel hosting services:

Hostinger
£2.29 /mo
Starting price
Visit Hostinger
Rating based on expert review
  • User Friendly
    4.7
  • Support
    4.7
  • Features
    4.8
  • Reliability
    4.8
  • Pricing
    4.7
HostArmada
£1.91 /mo
Starting price
Visit HostArmada
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.5
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.0
Ultahost
£1.92 /mo
Starting price
Visit Ultahost
Rating based on expert review
  • User Friendly
    4.3
  • Support
    4.8
  • Features
    4.5
  • Reliability
    4.0
  • Pricing
    4.8

How to Fix an HTTP Error Appearing in the WordPress Media Library

This is an article which will help you solve the HTTP error you get in the media
less than a minute
Eliran Ouzan
Eliran Ouzan
Web Designer & Hosting Expert

How to Solve a “Warning: Error While Sending QUERY Packet” Error

This is one of the rarest errors people come across. The article will cover all
less than a minute
Bruno Mirchevski
Bruno Mirchevski
Hosting Expert

How to Solve "Maximum Execution Time Exceeded" Error of a WordPress Website

This how-to guide provides the solution to fix Maximum Execution Time Exceeded e
less than a minute
Bruno Mirchevski
Bruno Mirchevski
Hosting Expert

How to Fix Image Upload Issue of Your WordPress Website Using FTP

This how-to guide explains the cause and solution of image upload error for a Wo
less than a minute
Bruno Mirchevski
Bruno Mirchevski
Hosting Expert
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top