Reroute Drupal 9 site from http to https using the .htaccess file

Go to the root directory of Drupal 9 site and change the write permission of the .htaccess file to write enable.
sudo chmod 777 .htaccess

Open .htaccess with nano command
sudo nano .htaccess

Insert the following lines:

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:jhun\.verterra\.me)?(.*)$ [NC]
RewriteRule (.*){REQUEST_URI} [L,R=301]


The above insertion is best placed below the redirection from WWW to without WWW.

Exit from nano and save the .htaccess file

Revert the permission
sudo chmod 644 .htaccess

Go to your browser and check if redirection from http to https works. You may need to flush all cache.