Code integrity .htaccess not passed the integrity check

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

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...
                        )

                )

        )

)

Steps to replicate it (hint: details matter!):

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:

Solutions attempted:

  1. Tried ernolf’s “nc-integrity-fix”-script, as detailed here:

https://help.nextcloud.com/t/nc-integrity-fix-script-to-resolve-some-files-have-not-passed-the-integrity-check-warnings/194729

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


  1. 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!)

  1. I also tried this suggested fool-the-system work-around:

https://help.nextcloud.com/t/27-1-1-howto-reset-invalid-hash-on-htaccess-to-eliminate-issue-in-admin-overview/170766

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:

  1. Why am I getting this error
  2. How do I get rid of it (permanently)?

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

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

If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.

N/A

Web server / Reverse Proxy

The output of your Apache/nginx/system log in /var/log/____:

Couldn’t see anything relevant

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

Tips for increasing the likelihood of a response

  • Use the preformatted text formatting option in the editor for all log entries and configuration output.
  • If screenshots are useful, feel free to include them.
    • If possible, also include key error output in text form so it can be searched for.
  • Try to edit log output only minimally (if at all) so that it can be ran through analyzers / formatters by those trying to help you.

How, precisely, are you updating?