# Caldav and carddav error resolving

**URL:** <https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435>\
**Category:** ℹ️ Support\
**Created:** [October 18, 2018, 8:17pm UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435 "2018-10-18T20:17:24Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertkwild](https://help.nextcloud.com/letter_avatar/robertkwild/32/5_5575768a8748004e209b776fc1b2916d.png) [@robertkwild](https://help.nextcloud.com/u/robertkwild)\
**Post date:** [October 18, 2018, 8:17pm UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/1 "2018-10-18T20:17:24Z")

</div>

hi all,

i have this problem in my overview -

Your web server is not properly set up to resolve “/.well-known/caldav”. Further information can be found in the [documentation](https://docs.nextcloud.com/server/14/go.php?to=admin-setup-well-known-URL).

where do i add these lines in -

Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav  
Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav

do i add it in “var/www/html/.htaccess” ie my root web server not my nextcloud instance ie “var/www/html/nextcloud/.htaccess”?

many thanks,  
rob

---

<div class="post-metadata">

**Author:** ![landygrundy](https://help.nextcloud.com/letter_avatar/landygrundy/32/5_5575768a8748004e209b776fc1b2916d.png) [@landygrundy](https://help.nextcloud.com/u/landygrundy)\
**Post date:** [October 19, 2018, 10:55am UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/2 "2018-10-19T10:55:30Z")

</div>

Per the documentation, you add them to your .htaccess file, It would be in the root of your Nextcloud instance.

---

<div class="post-metadata">

**Author:** ![robertkwild](https://help.nextcloud.com/letter_avatar/robertkwild/32/5_5575768a8748004e209b776fc1b2916d.png) [@robertkwild](https://help.nextcloud.com/u/robertkwild)\
**Post date:** [October 19, 2018, 9:43pm UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/3 "2018-10-19T21:43:49Z")

</div>

ok so i guess i edit the file - “/var/www/html/nextcloud/.htaccess”

RewriteRule ^Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav [R=301,L]  
RewriteRule ^Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav [R=301,L]

is that correct

---

<div class="post-metadata">

**Author:** ![dimostin](https://help.nextcloud.com/letter_avatar/dimostin/32/5_5575768a8748004e209b776fc1b2916d.png) [@dimostin](https://help.nextcloud.com/u/dimostin)\
**Post date:** [October 22, 2018, 10:07am UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/4 "2018-10-22T10:07:13Z")

</div>

i have this in my .htaccess:

```
<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/host-meta /public.php?service=host-meta [QSA,L]
  RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L]
  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]
  RewriteCond %{REQUEST_URI} !^/\.well-known/(acme-challenge|pki-validation)/.*
  RewriteRule ^(?:\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>

```

and in my overview i can still see the error :

```
There are some warnings regarding your setup.

* Your web server is not properly set up to resolve "/.well-known/caldav". Further information can be found in the [documentation](https://docs.nextcloud.com/server/14/go.php?to=admin-setup-well-known-URL).
* Your web server is not properly set up to resolve "/.well-known/carddav". Further information can be found in the [documentation](https://docs.nextcloud.com/server/14/go.php?to=admin-setup-well-known-URL).

```

i tried add the lines bellow to my .htaccess and i have commented the ones above and my nextcloud isn’t working anymore:

```
RewriteRule ^Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav [R=301,L]
RewriteRule ^Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav [R=301,L]

```

what am i doing wrong ?

---

<div class="post-metadata">

**Author:** ![MichaIng](https://help.nextcloud.com/user_avatar/help.nextcloud.com/michaing/32/2125_2.png) [@MichaIng](https://help.nextcloud.com/u/MichaIng)\
**Post date:** [October 22, 2018, 12:11pm UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/5 "2018-10-22T12:11:12Z")

</div>

You have two possibilities:

- Using redirect rules from mod\_alias, as in OT, to let the clients send a new requests to the redirects address/path.
- Using rewrite rules from mod\_rewrite, handling the path adjustment silently server side without new client requests, as suggested in the follow up answers.

I don’t know much about pros/cons, the first solution seems a bid simpler though.  
But each of them need to be set inside your webserver or vhost config, as long add Nextcloud is not already your webroot. How should otherwise the server know about requests/redirects if the related rules ate in a sub directory .htaccess where it’s not yet inside 🙂.

For the same reason the default .htaccess inside Nextcloud directory does not have any effect. It just works with Nextcloud add webroot, pointing to the then correct relative path without /nextcloud subdir inside.

---

<div class="post-metadata">

**Author:** ![robertkwild](https://help.nextcloud.com/letter_avatar/robertkwild/32/5_5575768a8748004e209b776fc1b2916d.png) [@robertkwild](https://help.nextcloud.com/u/robertkwild)\
**Post date:** [October 23, 2018, 12:16am UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/6 "2018-10-23T00:16:44Z")

</div>

sorted,

you add it in “/etc/httpd/conf.d/ssl.conf”, make sure its inbetween your virtualhost lines -

Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav  
Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav

---

<div class="post-metadata">

**Author:** ![vinc](https://help.nextcloud.com/letter_avatar/vinc/32/5_5575768a8748004e209b776fc1b2916d.png) [@vinc](https://help.nextcloud.com/u/vinc)\
**Post date:** [November 1, 2018, 6:45pm UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/7 "2018-11-01T18:45:34Z")

</div>

hello @robertkwild  
i have a same problem but i dont have a ssl.conf file ;-(

i have done - but still it is not working with caldav to sync

**\>vi /var/www/html/nextcloud/.htaccess**  
81 #### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####  
82 Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav  
83 Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav  
84  
85 ErrorDocument 403 //  
86 ErrorDocument 404 //

---

<div class="post-metadata">

**Author:** ![mable](https://help.nextcloud.com/letter_avatar/mable/32/5_5575768a8748004e209b776fc1b2916d.png) [@mable](https://help.nextcloud.com/u/mable)\
**Post date:** [November 25, 2018, 11:38pm UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/8 "2018-11-25T23:38:00Z")

</div>

I had the same problem and @robertkwild 's solution worked (many thanks!)

However, like @vinc, I don’t have `/etc/httpd/conf.d/ssl.conf` so instead, I opened my `/etc/apache2/sites-enabled/default-ssl.conf` and added the two lines

Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav  
Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav

_below_ the `<VirtualHost>...</VirtualHost>` section (but _above_ `</IfModule>`).

Although this works and I don’t get the warnings anymore, I don’t understand at all _why_ it works. I would appreciate any hints why the lines work in this place and not in the `nextcloud.conf` or any `.htaccess` file in `/var/www/html` or `/var/www/nextcloud` like the documentation suggests…

---

<div class="post-metadata">

**Author:** ![thedonquixotic](https://help.nextcloud.com/user_avatar/help.nextcloud.com/thedonquixotic/32/36163_2.png) [@thedonquixotic](https://help.nextcloud.com/u/thedonquixotic)\
**Post date:** [July 20, 2019, 5:17pm UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/9 "2019-07-20T17:17:55Z")

</div>

> [@robertkwild](#):
>
> sorted,
> 
> you add it in “/etc/httpd/conf.d/ssl.conf”, make sure its inbetween your virtualhost lines -
> 
> Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav  
> Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav

I don’t have a httpd folder in my etc folder like mable but I’m also not running apache. I am running nginx. I tried checking out the ssl.conf for my nginx settings but when I add the extra lines it makes it so that my nginx won’t start or restart.

I tried adding it to `etc/nginx/sites-enabled/cloud.jackalope.tech` (that’s the name of my cloud server) and restarted but I’m still getting the same caldav related error codes in the web portal

---

<div class="post-metadata">

**Author:** ![thedonquixotic](https://help.nextcloud.com/user_avatar/help.nextcloud.com/thedonquixotic/32/36163_2.png) [@thedonquixotic](https://help.nextcloud.com/u/thedonquixotic)\
**Post date:** [November 19, 2019, 6:54pm UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/10 "2019-11-19T18:54:31Z")

</div>

I fixed this issue and now I’m getting it again when trying to update to NC 17… very annoying this keeps popping up. I have no clue why it’s happening. I’m nearing the point where I think I might just try wiping this server and starting over. Doing so would be very annoying though and I’m not looking forward to the prospect.

---

<div class="post-metadata">

**Author:** ![Oscar\_G.A](https://help.nextcloud.com/user_avatar/help.nextcloud.com/oscar_g.a/32/22586_2.png) [@Oscar\_G.A](https://help.nextcloud.com/u/Oscar_G.A)\
**Post date:** [March 25, 2020, 2:23pm UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/11 "2020-03-25T14:23:44Z")

</div>

> [@mable](#):
>
> Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav  
> Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav

It works fine for me. Many thanks!

---

<div class="post-metadata">

**Author:** ![hep](https://help.nextcloud.com/user_avatar/help.nextcloud.com/hep/32/24096_2.png) [@hep](https://help.nextcloud.com/u/hep)\
**Post date:** [April 23, 2020, 12:51pm UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/12 "2020-04-23T12:51:17Z")

</div>

That is working for me 🙂  
Thanks

---

<div class="post-metadata">

**Author:** ![4slam](https://help.nextcloud.com/user_avatar/help.nextcloud.com/4slam/32/39662_2.png) [@4slam](https://help.nextcloud.com/u/4slam)\
**Post date:** [June 11, 2020, 12:34am UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/13 "2020-06-11T00:34:41Z")

</div>

I too am seeing “Your web server is not properly set up to resolve…” for **/.well-known/carddav** and **/.well-known/caldav**.

My Nextcloud 19 instance is also in a subdirectory in the web server document root directory:  
**\<web\_server\_doc\_root\>/nextcloud**

The only Apache config file I can change is .htaccess. Here’s my **\<web\_server\_doc\_root\>/.htaccess** :

```
Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav
Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav    
<IfModule mod_rewrite.c>
      RewriteEngine on
      RewriteRule ^\.well-known/host-meta /nextcloud/public.php?service=host-meta [QSA,L]
      RewriteRule ^\.well-known/host-meta\.json /nextcloud/public.php?service=host-meta-json [QSA,L]
      RewriteRule ^\.well-known/webfinger /nextcloud/public.php?service=webfinger [QSA,L]
      RewriteRule ^\.well-known/nodeinfo /nextcloud/public.php?service=nodeinfo [QSA,L]
      RewriteRule ^\.well-known/carddav /nextcloud/remote.php/dav/ [R=301,L]
      RewriteRule ^\.well-known/caldav /nextcloud/remote.php/dav/ [R=301,L]
</IfModule>
<IfModule mod_headers.c>
      Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>

```

😞

**_Update_:**  
The lines beginning with “Redirect 301 …” are not needed. Those redirects are already defined as RedirectRules:

```
          RewriteRule ^\.well-known/carddav /nextcloud/remote.php/dav/ [R=301,L]
          RewriteRule ^\.well-known/caldav /nextcloud/remote.php/dav/ [R=301,L]

```

URLs [https://example.com/.well-known/caldav](https://example.com/.well-known/caldav) and [https://example.com/.well-known/carddav](https://example.com/.well-known/carddav) do get redirected to [https://example.com/nc/remote.php/dav/](https://example.com/nc/remote.php/dav/), and I’ve been able to connect to CalDAV and CardDAV from my Android device. I’m therefore ignoring the “… not properly set up to resolve …” error messages.

---

<div class="post-metadata">

**Author:** ![MHBraun](https://help.nextcloud.com/letter_avatar/mhbraun/32/5_5575768a8748004e209b776fc1b2916d.png) [@MHBraun](https://help.nextcloud.com/u/MHBraun)\
**Post date:** [September 13, 2020, 3:01pm UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/14 "2020-09-13T15:01:33Z")

</div>

For some reason the documentation in [https://docs.nextcloud.com/server/19/admin\_manual/issues/general\_troubleshooting.html#service-discovery](https://docs.nextcloud.com/server/19/admin_manual/issues/general_troubleshooting.html#service-discovery)  
does not work with my 19.0.3 installation.  
Tried modified .htaccess in /var/www/html and in /var/www/html/nextcloud with no success.  
This one worked with adding the redirect to `/etc/apache2/sites-enabled/000-default-le-ssl.conf`  
Thank you for the hint

---

<div class="post-metadata">

**Author:** ![gibikha](https://help.nextcloud.com/user_avatar/help.nextcloud.com/gibikha/32/32133_2.png) [@gibikha](https://help.nextcloud.com/u/gibikha)\
**Post date:** [December 16, 2020, 10:45am UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/15 "2020-12-16T10:45:01Z")

</div>

Hi,

This seems to be a very annoying and unresolved “issue” for a long time.  
The issue is not in any of _your_ config files at all, it is in the apache configuration.

In the section defining the directory where _your_ nextcloud installation resides, please make sure that the following options match:

```
DocumentRoot "/path/to/nextcloud"
<Directory /path/to/nextcloud>
  Require all granted
  AllowOverride All
  Options FollowSymLinks MultiViews

  <IfModule mod_dav.c>
    Dav off
  </IfModule>
</Directory>

```

If `AllowOverride` is not set this way, it prevents other configuration files from overriding the options as set by apache, which would prevent `.htaccess` from working as expected.  
This could either be in the `httpd.conf` file, or a virtual host file, depending on your setup.

This is what it would look like in the `httpd.conf` file, in the `DocumentRoot` - your configuration may vary.

-G

---

<div class="post-metadata">

**Author:** ![Randre\_Wright](https://help.nextcloud.com/user_avatar/help.nextcloud.com/randre_wright/32/35553_2.png) [@Randre\_Wright](https://help.nextcloud.com/u/Randre_Wright)\
**Post date:** [February 28, 2021, 12:48pm UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/16 "2021-02-28T12:48:37Z")

</div>

> [@mable](#):
>
> opened my `/etc/apache2/sites-enabled/default-ssl.conf` and added the two lines
> 
> Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav  
> Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav
> 
> _below_ the `<VirtualHost>...</VirtualHost>` section (but _above_ `</IfModule>`).

Thank you. This worked for me too. My file in /etc/apache2/sites-enabled/ was called “000-default-le-ssl.conf”.

---

<div class="post-metadata">

**Author:** ![Dargus\_Kelen](https://help.nextcloud.com/user_avatar/help.nextcloud.com/dargus_kelen/32/38146_2.png) [@Dargus\_Kelen](https://help.nextcloud.com/u/Dargus_Kelen)\
**Post date:** [May 13, 2021, 4:31am UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/17 "2021-05-13T04:31:40Z")

</div>

@gibikha

You hit the nail on the head for me!

---

<div class="post-metadata">

**Author:** ![kokokazem](https://help.nextcloud.com/user_avatar/help.nextcloud.com/kokokazem/32/38224_2.png) [@kokokazem](https://help.nextcloud.com/u/kokokazem)\
**Post date:** [May 16, 2021, 3:05pm UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/18 "2021-05-16T15:05:01Z")

</div>

@gibikha  
@Dargus_Kelen  
here is the open issue on [github](https://github.com/nextcloud/docker/issues/1366):  
would you please tell us what changes have you made and to what files?. i dont have` httpd.conf` file. all i have are those directories 1. `sites-avaliable` in which the following files reside `000-default.conf default-ssl.conf` and the sites-enabled directory in which there is only the `000-default.conf` file, and lastly the `apache2.conf` file i added those two lines:

```
    RewriteRule ^Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav [R=301,L]
RewriteRule ^Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav [R=301,L]

```

i edit `etc/apache2/apache2.conf` file and changed `AllowOverride` for `/var/www/` from `none` to `all` but nextcloud still shows the same message:  
but this didnt resolve the issue ☹

---

<div class="post-metadata">

**Author:** ![gibikha](https://help.nextcloud.com/user_avatar/help.nextcloud.com/gibikha/32/32133_2.png) [@gibikha](https://help.nextcloud.com/u/gibikha)\
**Post date:** [May 24, 2021, 1:39pm UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/19 "2021-05-24T13:39:54Z")

</div>

Hi,

Can you share details of your set up?

What we need to do is make a backup of the files as they are first, since the config as is it works, aside from the DAV issue.

Then let’s find the DocumentRoot block in your apache2.conf file.

What does that block look like?

It has to look exactly as described in the official documentation, found here =\> [Installation on Linux — Nextcloud latest Administration Manual latest documentation](https://docs.nextcloud.com/server/latest/admin_manual/installation/source_installation.html)

Then we can see what’s up thereafter.

-G

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 4, 2024, 8:03am UTC](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435/20 "2024-12-04T08:03:07Z")

</div>



[Next page](https://help.nextcloud.com/t/caldav-and-carddav-error-resolving/39435.md?page=2)
