Htaccess for subfolder

If you want to mess around with those kinds of directives for Nextcloud, you really should do so in your webserver configuration files instead of htaccess in the filesystem. If you change files in the webroot, you WILL break the Nextcloud upgrade functionality.

If you insist on putting in a “phpinfo” or other script, create a new tree OUTSIDE of the nextcloud webroot and refer to it using an alias in your nextcloud virtualhost in your webserver configuration, something like this; Alias "/phpinfo.php" "/var/www/otherfiles/phpinfo.php"

You’ll also need to define a Directory for that new webroot, something like this;

<Directory "/var/www/otherfiles">
   Order allow,deny
   Allow from all
</Directory>