i must get to work this 3 conditions because my website works on both english and spanish, depending the browser it must redirect to spanish or stay in english and i need to get sure that all my visitors reach it no matter they access via www or non www and has to always point to https in ES or EN scenario
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\. [OR]
RewriteCond %{HTTP:Accept-Language} ^es [NC]
RewriteRule ^$ https://mywebsite/es/ [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(en|es)/?$ index.html?lang=$1 [QSA,NC,L]
Disclaimer: my speech doesn't answer your question directly.
As previous comment mentioned, language redirects are suboptimal practice. The best way (and the one recommended by Google) is:
Googlebot gets no cookies - it should crawl different language versions ONLY based on hreflang links.