On Nextcloud, the data directory is /app/data. In hindsight, this was a mistake and it should ideally be /app/data/datadirectory or something. We tried to fix this long ago, but it was complicated since nextcloud complains if you change the data directory, so we left it as-is.
Because of the above quirk, there are two htaccess files. One for the data directory itself (.htaccess) and one for the code directory (htaccess).
When we eventually move the data directory to be a subdirectory, the .htaccess will move with it.