Could not rename folder in the data directory if there is .htaccess


I am new here, so if I post on wrong section, I ask sorry.

I found a error when I try to rename a folder in the data directory using the webclient: could not rename “temp”

The log output is:

Fatal	webdav	OCP\Files\ForbiddenException: Invalid path

    /lib/private/Files/Storage/Wrapper/Wrapper.php - line 278:

    OC\Files\Storage\Local->rename("files/temp", "files/temp_")

    /lib/private/Files/Storage/Wrapper/Wrapper.php - line 278:

    OC\Files\Storage\Wrapper\Wrapper->rename("files/temp", "files/temp_")

    /lib/private/Files/View.php - line 816:

    OC\Files\Storage\Wrapper\Wrapper->rename("files/temp", "files/temp_")

    /apps/dav/lib/Connector/Sabre/Node.php - line 142:

    OC\Files\View->rename("/temp", "/temp_")

    /3rdparty/sabre/dav/lib/DAV/Tree.php - line 157:


    /3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 641:

    Sabre\DAV\Tree->move("files/..../temp", "files/..../temp_")

    /3rdparty/sabre/event/lib/WildcardEmitterTrait.php - line 89:

    Sabre\DAV\CorePlugin->httpMove(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})

    /3rdparty/sabre/dav/lib/DAV/Server.php - line 474:

    Sabre\DAV\Server->emit("method:MOVE", [ Sabre\HTTP ... }])

    /3rdparty/sabre/dav/lib/DAV/Server.php - line 251:

    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})

    /3rdparty/sabre/dav/lib/DAV/Server.php - line 319:


    /apps/dav/lib/Server.php - line 320:


    /apps/dav/appinfo/v2/remote.php - line 35:


    /remote.php - line 167:

    require_once("/var/lib/ne ... p")

I found that this happen when there is an .htaccess in that folder, also if it is a empty .htaccess uploaded by an user.

Nextcloud version 19.0.4
Operating system and version CentOS 7.8
Apache version 2.4.6
PHP version 7.2

The data folder is outside from DocumentRoot, by editing the config.php

'datadirectory' => '/data',

Have you please any suggestion to solve this issue?

Thanks in advance for your reply.

.htaccess in a folder is not a good idea. Perhaps an empty file deactivates the normal Rewrite. Deny uplading .htaccess .

yes, I know that, but there is a way to ignore it only in data folder? For example, if some one would use own space for backup a wordpress installation, he would like to keep also own htaccess. I know that is not a good practice, but happen…

Test this

<Directory "/home/user/test_domain_com/www">
    AllowOverride All
<Directory "/home/user/test_domain_com/www/test">
    AllowOverride None

I have already tried that using /data because is outside of DocumentRoot:

<Directory "/nextcloud_path">
    AllowOverride All
<Directory "/data">
    AllowOverride None

but doesn’t work, thanks.