Integrity Check failed ->> .htaccess file invalid

Nextcloud version: 26.0.2
Operating system and version : 22.04.02
Apache version : Apache/2.4.52
PHP version : 8.1.2

Hello everyone, hope you are doing fine.

Warning message appeared after updating modules ´Mail´ (to version 3.2.0) and ´Contacts´ to version 5.3.0 and ´Calendar´ version 4.4.1 (I have created a backup of my NC instance before the updates). At this moment I do not want to use my backup, since to me the issue seems repairable.

The message is: Some files have not passed the integrity check.
This is the first time I’ve seen this error.

The list of invalid files concluded that NC expected a different Hash Value for the file .htaccess.
I have modified this file long time ago, even before upgrading the NextCloud instance from v25 to v26. The modification included HSTS Header information only.


  1. Repair the .htaccess file by the command: sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess
    –>>> It did repair the file, but the integrity check still shows the same warning message

  2. Replacing the .htaccess file by a original .htaccess file, modified its ownership to www-data
    –>>> The warning message is still the same. (But now including the HSTS header security message for which I had modified my .htaccess file)

  3. I have rebooted the system in both repair trials, but no changed in the results

  4. I have tried to disable the integrity check (although this is not a proper solution, since it is a security item). Adding a line with ´integrity_check_disabled´ in the config.php file inside the Config directory of NC did not disabled the integrity check at all.

THE CONFIG FILE DETAILS (in case needed)

<?php $CONFIG = array ( 'instanceid' => ' ...... something .......', 'passwordsalt' => '4.......... bla bla bla bla .....oDRZU', 'secret' => '51vVDE2 ....................................... Zojmmji', 'trusted_domains' => array ( 0 => 'xxxxxxxx', 1 => 'xxxxxxxxxxxx', 2 => 'xxxxxxxxxxxx', ), 'datadirectory' => '/xxxx/xxxxx', 'dbtype' => 'mysql', 'version' => '', 'overwrite.cli.url' => 'xxxxxxxxxxxxxxxxx', 'dbname' => 'xxxxxxxxxxx', 'dbhost' => 'xxxxxxxxxxxx', 'dbport' => '', 'dbtableprefix' => 'xxxx_', 'mysql.utf8mb4' => true, 'dbuser' => 'xxxxxxxxxx', 'dbpassword' => 'xxxxxxxxx', 'installed' => true, 'filelocking.enabled' => true, 'memcache.local' => '\\OC\\Memcache\\APCu', 'memcache.locking' => '\\OC\\Memcache\\Redis', 'redis' => array ( 'host' => 'xxxxxxx', 'port' => xxxxxx, ), 'mail_from_address' => 'xxxxxxxxx', 'mail_smtpmode' => 'xxxxxx', 'mail_smtpsecure' => 'ssl', 'mail_sendmailmode' => 'xxxx', 'mail_domain' => 'xxxxxxxx', 'mail_smtpauthtype' => 'xxxxx', 'mail_smtphost' => 'xxxxxxxx', 'mail_smtpport' => 'xxxxxx', 'mail_smtpauth' => 1, 'mail_smtpname' => 'xxxxxxxx', 'mail_smtppassword' => 'xxxxxxxxx', 'default_phone_region' => 'xxxxxxxx', 'maintenance' => false, 'theme' => '', 'loglevel' => 2, ); I hope someone can guide me in this matter for a proper solution. thanks in advance!!

I have found the solution for the issues in my Nextclous instance. The solution comes froma topic from Akhenaton in July 2016 (Failed integrity check after manual upgrade - #6 by Akhenaton)

  1. Add the folling line in the /config/config.php file:
    → ‘integrity.check.disabled’ => true,
  2. Now reload the page ‘Security & setup warnings’
  3. When you see the yellow banner click on rescan
  4. Log-out
  5. Log back in as admin you will not the integrity failure anymore
  6. Now delete the line that you put in your /config/config.php file to re-enable the integrity check

This did work for me. And I hope someone finds use in the topic…
Regards and stay safe.