The Basics
- Nextcloud Server version (e.g., 29.x.x):
35.0.2
- Operating system and version (e.g., Ubuntu 24.04):
Ubuntu 22.04
- Web server and version (e.g, Apache 2.4.25):
2.4.69
- Reverse proxy and version _(e.g. nginx 1.27.2)
n/a
- PHP version (e.g, 8.3):
8.3.36
- Is this the first time you’ve seen this error? (Yes / No):
Yes
- When did this problem seem to first start?
Just before and since upgrading from v 34.0.5 to v 35.0.2
- Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
Bare metal
- Are you using CloudfIare, mod_security, or similar? (Yes / No)
Cloudflare - Yes
Summary of the issue you are facing:
My .htaccess file has failed a “code integrity” check
From my Admin Settings Overview page:
Code integrity
Some files have not passed the integrity check. List of invalid files… Rescan…
And when I hit the “List of invalid files”-option, i get:
Raw output
==========
Array
(
[core] => Array
(
[INVALID_HASH] => Array
(
[.htaccess] => Array
(
[expected] => a2d827c...
[current] => 17477516e...
)
)
)
)
The problem appeared just before I updated NC from v 34.0.5 to 35.0.2 (my current version) and I thought I had successfully dealt with it via the second solution below:
EDIT: the 3rd attempted solution below produced an acceptable outcome - see also the end of this thread
Solutions attempted:
- Tried ernolf’s “nc-integrity-fix”-script, as detailed here:
Didn’t help:
azed@azed-byte:~$ nc-integrity-fix
This app is affected:
core
The hash of this file in [core] is invalid:
.htaccess
Q: Do you want to replace this invalid file with a file downloaded from github
for your version?
Make your choice: ([y]es or [n]o) [yes]: y
download of '.htaccess' failed. You must check this one yourself
- Tried to replace my .htaccess-file for an “uncorrupted” one, as detailed here:
https://help.nextcloud.com/t/code-integrity-check-problems/1895/2
Downloaded the appropriate (v. 34.0.5) nextcloud files from here:
https://nextcloud.com/changelog/#latest34
-- Extracted the .htaccess file
-- Checked permissions matched:
OLD
azed@azed-byte:~$ ls -l /var/www/nextcloud/.htaccess
-rw-r--r-- 1 www-data www-data 7940 Oct 17 17:02 /var/www/nextcloud/.htaccess
NEW
azed@azed-byte:~$ ls -l /home/azed/Downloads/Nextcloud/nextcloud-34.0.5/.htaccess
-rw-r--r-- 1 azed azed 6677 Oct 15 09:17 /home/azed/Downloads/Nextcloud/nextcloud-34.0.5/.htaccess
-- Fixed file ownership:
sudo chown www-data:www-data /home/azed/Downloads/Nextcloud/nextcloud-34.0.5/.htaccess
azed@azed-byte:~$ ls -l /home/azed/Downloads/Nextcloud/nextcloud-34.0.5/.htaccess
-rw-r--r-- 1 www-data www-data 7940 Oct 24 15:44 /home/azed/Downloads/Nextcloud/nextcloud-34.0.5/.htaccess
-- Replaced the old .htaccess-file with the new
azed@azed-byte:~$ sudo mv /home/azed/Downloads/Nextcloud/nextcloud-34.0.5/.htaccess /var/www/nextcloud/.htaccess
-- Reloaded apache2
azed@azed-byte:~$ sudo systemctl reload apache2
When I re-loaded the Administrator Settings Overview page, the code integrity warning had disappeared (hoorah!)
However, after the update to NC v 35.0.2, it re-appeared (boo!)
- I also tried this suggested fool-the-system work-around:
see also here:
https://help.nextcloud.com/t/integrity-check-failed-htaccess-file-invalid/163774/2
Did as suggested:
-- Edited end of /var/www/nextcloud/config/config.php
From:
'mail_smtpport' => '465',
'mail_smtpauth' => 1,
'mail_smtpname' => ``'``withheld',
'mail_smtppassword' => 'withheld',
'theme' => '',
'loglevel' => 2,
'htaccess.RewriteBase' => '/',
'serverid' => '0',
);
To:
'mail_smtpport' => '465',
'mail_smtpauth' => 1,
'mail_smtpname' => 'withheld',
'mail_smtppassword' => 'withheld',
'theme' => '',
'loglevel' => 2,
'htaccess.RewriteBase' => '/',
'serverid' => '0',
'integrity.check.disabled' => true,
);
-- Saved file
-- Re-loaded Admin Settings Overview page - code-integrity error had vanished
-- Removed the line " ‘integrity.check.disabled’ => true, " from /var/www/nextcloud/config/config.php
-- Logged out and in again: code integrity problem was back (sigh)
QUESTIONS:
- Why am I getting this error
- How do I get rid of it (permanently)?
Log entries
Nextcloud
Here are a couple of entries from the Administrator Settings Overview “Logging”-page from the time of my update to v35.0.2. They don’t appear to me to be very useful:
{"reqId":"wUKyvHlXi3QI9dtIWqOU","level":1,"time":"2026-10-24T14:23:27+00:00","remoteAddr":"192.168.1.237","user":"--","app":"updater","method":"GET","url":"/ocs/v2.php/core/update?requesttoken=YbI9hp8CZHCM4T1rGdgDoxh9N9PqUVUjQO%2FMcgIOb0w%3D%3AEvdL4fBnUgSng2wyd6Fl8ltMTrrTGjpvCt%2BFHHA5IQA%3D","scriptName":"/ocs/v2.php","message":"\OC\Updater::startCheckCodeIntegrity: Starting code integrity check...","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/154.0.0.0 Safari/537.36 OPR/138.0.0.0","version":"34.0.5.1","data":{"app":"updater"},"id":"6ae8a58bc769b"}
{"reqId":"wUKyvHlXi3QI9dtIWqOU","level":1,"time":"2026-10-24T14:23:35+00:00","remoteAddr":"192.168.1.237","user":"--","app":"updater","method":"GET","url":"/ocs/v2.php/core/update?requesttoken=YbI9hp8CZHCM4T1rGdgDoxh9N9PqUVUjQO%2FMcgIOb0w%3D%3AEvdL4fBnUgSng2wyd6Fl8ltMTrrTGjpvCt%2BFHHA5IQA%3D","scriptName":"/ocs/v2.php","message":"\OC\Updater::finishedCheckCodeIntegrity: Finished code integrity check","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/154.0.0.0 Safari/537.36 OPR/138.0.0.0","version":"34.0.5.1","data":{"app":"updater"},"id":"6ae8a58bc7696"}
Web Browser
N/A
Web server / Reverse Proxy
Couldn’t see anything relevant /var/log/____
Configuration
Nextcloud
The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):
Can be provided if you think it would help
Apps
Again, list of apps can be provided if you think it would help