I guess since no one seems to know, some might like to know the answers I got on my own. It might be helpful. (maybe not?)
First, the .htaccess can be in the script’s directory, or any parent directory. Apache looks for it. So I place .htaccess in my root directory.
So this works:
Other methods worked, as well.