Turning on the SSL certificate in WordPress
If You want your site working on secure connection, or the method you use does not work fully, I encourage you to read this guide.
A secure, encrypted connection using the SSL certificate and the https protocol is a desirable feature of the site, which is increasingly attracted by website users, but also browsers and search engines.
So it is worth devoting a moment to adjusting your website to current trends.
In this article we will show You step by step what to do to use installed on serwer SSL certificate on your WordPress site.
If you want a green padlock to appear in the browser, you need: an SSL certificate installed on the server (eg free Let’s Encrypt or Comodo / cPanel) and a setting for WordPress to display pages using the https protocol.
Manual correction (the only correct version of SSL inclusion in WordPress):
The best way to switch to a secure SSL connection is to update all entries in the database from http to https .
If we use this method the improvement on https will be permanent, so you only need to make the change once and enjoy a secure connection.
Another advantage of using this method is changing the creation of new entries in the future – each new entry will be created with the correct link in the database.
1. So lets start and in first step we need to go to backend of WordPress and then go to settings -> general and change adresses from http to https
2. Now we need to click save changes at the end of the site and then go to setting -> permalinks and here also click save changes this will rebuild all links in database to safe links with https.
3. Go to cPanel -> File Manager, go to the main directory of our site and click Settings, select tick Show hidden files (dotfiles)
4. Now find .htaccess file in your domain folder
5. Open the .htaccess file by right-clicking on it and selecting Edit. We add the following lines at the beginning of the file. We leave the rest of the file content below the entries we added:
Without the prefix www:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
With the www prefix:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
The above entries will redirect visitors to a secure connection if they enter via the http link instead of https.
- Clearing redis cache memory - December 22, 2022
- Does “Time to first byte” (TTFB) means server speed? - October 31, 2022
- Automatic WordPress login security by reCaptcha - August 24, 2021