Properly resolving "/.well-known/caldav" or "/.well-known/carddav"

I’m going over issues in my Nextcloud (18.0.4 – just updated) & this is one of the few issues left!

* Your web server is not properly set up to resolve "/.well-known/caldav". Further information can be found in the [documentation](
* Your web server is not properly set up to resolve "/.well-known/carddav". Further information can be found in the [documentation](

I’m using manual install on Ubuntu Server 18.04 (headless) with Apache2 & the NC home path is “/var/www/nextcloud”

the mod_rewrite section of my .htaccess file in

<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/webfinger /public.php?service=webfinger [QSA,L]
  RewriteRule ^\.well-known/nodeinfo /public.php?service=nodeinfo [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]

I don’t know if this is related or not but I am currently accessing my path via rather than just as goes to the default Apache success page.

Thanks in advance!!

PS: There are a number of similar topics, but no relevant answers in those posts that I found :frowning:

I’ve got the same issue, did you ever resolve this problem?
When I look in the documents, if you have your nextcloud in a subfolder, you should add this behind the well-known lines.

e.g ^.well-known/carddav /nextcloud/remote.php/dav/ [R=301,L]

I did that, still didn’t work. So if you did get a solution, I would be very happy if you shared it.


I never did get it working. Honestly it’s been a while since I’ve looked at this…but if you ever find a solution, feel free to post it! I’d much appreciate it :slight_smile:

1 Like

This is my Solution that worked for my.
If your working with Apache this should help place it in your vhost config.

        RewriteEngine On
            RewriteRule ^/\.well-known/carddav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
            RewriteRule ^/\.well-known/caldav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]

if you doesnt use https use this

        RewriteEngine On
            RewriteRule ^/\.well-known/carddav http://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
            RewriteRule ^/\.well-known/caldav http://%{SERVER_NAME}/remote.php/dav/ [R=301,L]

@Adriaan_van_Vliet It looks like the difference between your entry and my entry is the “/” in the characters: ^/\. I’ll give that a try! Glad to have something concrete to try! With any luck, it’ll even work :slight_smile:

an did it work ?

@Adriaan_van_Vliet sorry to leave you hanging. But I am trying to upgrade to NC 21 right now, and haven’t had a chance to try this. Currently stuck on a php error where I should see NC…

Just wanted to report back for the sake of closure. Upgrading ended up being a total nightmare (new php → new host OS → not a simple upgrade). So I ended up creating a new host for Nextcloud & just pointing to the same config files & database & data & all that. Apparently this issue fixed itself.

By that I actually mean two related but distinct things. When I first installed Nextcloud 21, I had a list of issues in the management tab, including 4 (not just the 2 I was used to) related to well-known. I ran a few of the fixes, but did nothing to address these specifically before going to bed. When I checked on it the next morning, all the “well-known” issues were fixed.

So I guess it’s solved? Not sure how (unless they made a change to the config file)–but I’m not looking a gift horse in the mouth!

Regardless, I appreciate the help & didn’t want to leave you hanging!

Update for NC 21 (relevant for previous versions as well):

I had the same issue, but in my experience it’s always an issue of having the proper rewrite rules set in your server configuration. Adrian’s solution should work for any version; for SSL:

         RewriteRule ^/\.well-known/carddav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
        RewriteRule ^/\.well-known/caldav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]

I have not been able to get webfinger or nodeinfo to work, however.

There is some nice documentation on this in the official Nextcloud troubleshooting:

Unfortunately, I was not able to get this to work. I tried updating the .htaccess in all three places, but no luck.

  • ./var/www/nextcloud/.htaccess
  • ./var/www/nextcloud/config/.htaccess
  • ./var/www/nextcloud/data/.htaccess

Any guidance on this?