RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) https://www.example.com/$1 [R=301,L]
Under Files, click on File Manager.
Ensure that Show Hidden Files is selected by clicking Settings on the top right corner of the File Manager. (see image)
Select the Document Root for: option, and choose your domain from the drop-down.
Right-click on the .htaccess file and select Edit.
If your .htaccess file is still not found after the previous steps, click on New File at the top-left, name the file .htaccess, and set the directory for the file to be created to /public_html/ or the document root of your site.
You might have a text editor encoding dialog box pop-up, you can simply click on Edit to proceed.
If you had an old domain such as example.com and you decided to use example.net for a website, you could setup a 301 redirect for the entire domain, so that old links to example.com carry over.
Sample of code from example.com domain’s .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) https://www.example.com/$1 [R=301,L]