Redirect all HTTP requests to HTTPS automatically using .htaccess and web.config

Redirect HTTP to HTTPS automatically with Linux-based and Windows. Using the following code in your .htaccess (Linux & cPanel) and web.config (Windows) file automatically redirects visitors to the HTTPS version of your site.
Linux & cPanel: Linux-based accounts use .htaccess files to handle redirection.
{OR}
Windows: Windows-based accounts use web.config files to handle redirection.