Using the .htaccess file
Using the .htaccess file: This file is in the root host. In order to open the site only with https or redirect all WordPress links from http to https, just enter the .htaccess file and put the provided codes depending on whether your host is Linux or Windows.
To redirect all site links from http to https on the Linux host, enter the following code in your .htaccess file located in the root of the host.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
By placing the above code in .htaccess, all users who visit your site, if they enter your site from search engines or links to your site on other websites or any link and in any way . Your site will be loaded with https protocol.
Important note:
If you already had the .htaccess file on your host, which naturally should be like this, you should not repeat "RewriteEngine On" again.
Place the second and third lines of the above code exactly after the "RewriteEngine On" statement.
It should be noted that if you visit the single link section in WordPress even once and click on save information, the .htaccess file will be automatically created on your host.
Wordpress index: 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 WordPress admin area. It also works on WordPress multisite networks.
Disabling HTTPS
To redirect all site links from https to http on the Linux host, enter the following code in your .htaccess file located in the root of the host.
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R,L]