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.

hi
you don’t need it outside

https://infinityfree.net/support/how-to-force-all-traffic-to-https/

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.