I also ran into an issue with .htaccess on a vanilla install (Ubuntu 20.04, Apache and PHP 8.1). After setting the userewrite config to 1 and uncommenting rewrite rules in .htaccess, my server throws a 500 internal server error.
I've been using DokuWiki with Nginx since many years, and only started using Apache due to ease of setup and configuration. However, if .htaccess nice urls are not working, maybe better to switch back. Unless someone has good advice and information to share?