How to automatically redirect your website url to https (SSL)

To add https:// automatically on your website, please follow the steps given below.
(This code is not applicable for WordPress)

  1. First check if your website is working by adding https:// manually in your browser.
  2. If its working fine with https://, please do the following
    1. Create (if not already created) a .htaccess file in your public_html folder.
    2. Add the below given code and replace domain.com with your own domain name.
    3. RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$RewriteEngine OnRewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L]

      Save this file and now your website should be running with https.

If you are using WordPress, please install Easy HTTPS Redirection plugin and enable it under WordPress Settings.