Here is a small excerpt from link showing how to solve this task.
If you want to redirect a website from the non-www version to the www version with https, the entry would look like this:
RewriteEngine On
RewriteCond %{HTTP_HOST}^eineseite.de$
RewriteRule ^(.*)https://www.eineseite.de/$1[L,R=301]
I tried to roughly translate it for you. Also, I think you won’t achieve this type of redirect without using 301 to 307 redirects. You could program your own web server, but I guess that’s not realistic.