How can I redirect requests to http(s)//domain.tld/WHATEVER.php
to http(s)//domain.tld/WHATEVER.php?lang=<?php substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); ?>
in PHP?
So, if you visit a URL already with a lang parameter, fine, do nothing. If the lang parameter is not present, 301 redirect to the URL containing the lang param.