I can't solve this problem

After updating to version 30 I get this error:

as per link, I inserted it on my .htaccess:

But I keep seeing the same error, could you tell me how to fix it?

Depends on some things. Unfortunately you overlooked the support template so we don’t have enough information about your environment to answer.

Creating a custom .htaccess in your web root is only necessary if you’ve deployed Nextcloud in a subdirectory.

this topic was discussed often setup_warning_wellknown please use search and describe what you tried so far and add logs

I installed nextcloud 30.0.11 on raspberry pi 4 8 ​​gb ram with Bullseye installed, installed apache2 server and mariaDB 10.6.22, php 8.4, my nextcloud is in: /var/www/nextcloud and file idem file .htaccess, The error above is the first time I’ve encountered it I don’t use nginx

I also tried to insert the recommended lines in the file: /etc/apache2/apache2.conf

but nothing..

As already mentioned here:

Nextcloud will maintain .htaccess on its own - usually there is no need to edit it manually.

To generate a new file:

cd /var/www/nextcloud
sudo -u www php occ maintenance:update:htaccess

Where /var/www/nextcloud is the root of your Nextcloud installation and www is the user used for your nextcloud hosting.

In this generated file you should then see the following section:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTP_USER_AGENT} DavClnt
  RewriteRule ^$ /remote.php/webdav/ [L,R=302]
  RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
  RewriteRule ^remote/(.*) remote.php [QSA,L]
  RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
  RewriteRule ^\.well-known/(?!acme-challenge|pki-validation) /index.php [QSA,L]
  RewriteRule ^ocm-provider/?$ index.php [QSA,L]
  RewriteRule ^(?:\.(?!well-known)|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>

If this does not work, maybe your Apache site configuration does not allow overriding options using .htaccess. The virtual host configuration should contain a directory definition similar to this:

        <Directory /var/www/nextcloud>
                Options +SymlinksIfOwnerMatch
                AllowOverride All
                Require all granted
                # Fix possible sync errors in Nextcloud for big files
                LimitRequestBody 0
        </Directory>

The important line here is AllowOverride All - this tells Apache, that options can be overridden using .htaccess.

Also keep in mind to enable the rewrite module in Apache.

try www-data instead of www

Maybe there was a misunderstanding. Do NOT use www but the user which YOUR machine uses (probabbly www-data).

So something like this:

cd /var/www/nextcloud
sudo -u www-data php occ maintenance:update:htaccess

And if www-data is also not correct, then YOU have to check, what user YOUR system uses.

And no, there is no need to use chown either. And if your Nextcloud is not at /var/www/nextcloud, you need to use the correct path of course!

I keep getting the error… here is my .htaccess file:

And this my /etc/apache2/apache2.conf:

Please do not just copy & paste your .htaccess here! This makes it really very hard to read!

If you want to add file contents here, please start with three backticks first (```) and then in a new line paste the content and then finish with a line with three backticks again.

I told you the relevant part - only this is important:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTP_USER_AGENT} DavClnt
  RewriteRule ^$ /remote.php/webdav/ [L,R=302]
  RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
  RewriteRule ^remote/(.*) remote.php [QSA,L]
  RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
  RewriteRule ^\.well-known/(?!acme-challenge|pki-validation) /index.php [QSA,L]
  RewriteRule ^ocm-provider/?$ index.php [QSA,L]
  RewriteRule ^(?:\.(?!well-known)|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>

I apologize for the mistake, I added the part you suggested but I still get the error at the beginning of the post

Can you please EDIT your post and put three backticks ( ``` ) in front of your .htaccess file and the same at the end? Then at least it is readable.

Like this (just without any spaces at the beginning of each line):

    ```
    the content of your .htaccess file goes here
  
    last line of your .htaccess file
    ```

Things to check in general:

  • Do you even use Apache? Yes this might sound silly - but maybe you are using NGINX and don’t realize that.
  • Is the rewrite module in Apache enabled (sudo a2enmod rewrite)?

And again: you do NOT need to edit .htaccess at all - just CHECK it, if it was generated correctly.

Yes, the file is regenerated, and I restarted the apache2 server
I only installed apache2, if NGINX was installed because some package needed certain dependencies I don’t know… is there a way to verify this?

And did you verify the the rewrite module is active?

sudo a2enmod rewrite

It keeps giving the same error

Sorry, I am out of options here.

Maybe Problems with the .htaccess file after updating to 29.0.0 - #4 by NeurohrByteS can help you.

I feel pinged… but actually I had that same error a couple of days ago on one of my four instances.

My solution was to

  1. Backup your .htaccess file
  2. Add below snippet as its own separate block
  3. Remove all other RewriteRules from the .well-known links you just added (i.e. ignore the acme-challenge, but remove the other webfinger rewrites)
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule ^\.well-known/carddav /remote.php/dav [R=301,L]
  RewriteRule ^\.well-known/caldav /remote.php/dav [R=301,L]
  RewriteRule ^\.well-known/webfinger /index.php/.well-known/webfinger [R=301,L]
  RewriteRule ^\.well-known/nodeinfo /index.php/.well-known/nodeinfo [R=301,L]
</IfModule>

Curiously a couple of days later php occ maintenance:update:htaccess worked as intended (and reset my manual changes without the error popping up again). Maybe some caching issue?

Long term I will probably create a new instance and restore a backup, since this is my oldest instance. Something seems to have gone wrong after two Linux distribution updates.

Even so I get the error

Instead of .htaccess give Apache’s include directory a try. Same block of rules but in a .conf file.