If the top answer is outdated and the official documentation actively recommends against it, future visitors should be informed of this in a visible manner, and be directed to the recommended alternative.
Stack Overflow is meant to be a place with accurate, correct, expert-validated information. The guidelines exist to facilitate this. The guidelines are written with the intent of making the site better. Dogmatically applying the guidelines as if they were "a law of physics" rather than "a law of society" to every single case, even when it actively harms the site, is just silly and bureaucratic. As the Zen of Python states: "practicality beats purity".
Stack Overflow should not be a site where expert reviewers contradict the official documentation for the sake of preserving some non-worthwhile goal. It would be great if we could flag and reduce the visibility of outdated answers. But until that functionality exists outside of the existing editing system, a Wikipedia-style header allows editors to communicate that information.
.htaccess
(which is the main question) ... from the doc : In the case of the http-to-https redirection, the use of RewriteRule would be appropriate if you don't have access to the main server configuration file, and are obliged to perform this task in a .htaccess file instead.