How I can add a .htaccess file outside the htdocs, it's deleted.

How can I add a .htaccess file it’s deleted automatically, I have a ssl and I need to redirect to the https.

you don’t need it outside

Please make sure you add the .htaccess file inside a htdocs folder (you can’t upload any files outside web accessible directories) and that your file manager is configured to show hidden files.