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.
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.
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.
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.
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:
- Click here to get the best wordpress hosting specialized for wordpress.