Non-native speaker here.
First choice: How do I ...
On a question-answering site, ask questions in proper English, and at best as if you would ask someoneasked some people around you right away, since that is what lets you aim at an answer, and that is what makes it clear onthe needed answer clearer at a first glimpse what, and it is the question aims at - an answerway most people enter their search in a search engine.
That is why youYou should not write "How to ...?", which is not 100-percent-proper English - see the remark under the question at "How to ... ?" questions might be wrong grammar. Will it help dropping the question mark for all questions or warning the user or something the like?:
It may not be 'proper' according to some, but it works.
Ask "How do I" / "How can I", which keeps it short and clear, and it is the main way how the people write down their search in the search engines.
Second and last choice (since Stack Exchange is not a blog): Blog-style "How to ... [without a question mark]" / gerund
If your question builds up a frame of a sort of technical writing, perhaps a self-answered question, a guide or some code that needs to be checked, you may (but rather should not) switch to a blog-style "How to ..." (without a question mark at the end) or a gerund. Both are noaren't questions, they are a style of blogs or technical platforms. That is why they do not fit well enough to athis question-answering site.