[Help] Old contacts app and carddav links changed: URL rewriting

Hello

I migrate my old owncloud installation (8.2.9) to the latests nextcloud version two days ago. But I can see that the carddavs links changed. The old links are some like these

https://mydomain.com/owncloud/remote.php/carddav/addressbooks/billgates/empresa_shared_by_otheruser/

And the new ones are like these

https://mydomain.com/owncloud/remote.php/dav/addressbooks/users/billgates/empresa_shared_by_otheruser/

Ok. I make a rewrite in .htaccess to solve this. I added this line

RewriteRule /remote.php/dav/addressbooks/users(.*) /remote.php/carddav/addressbooks/$1 [R=301,L]

This solve the link to a simple “folder” with contacts.

But there is another problem. To discover all the “folders” with contacts, there is another link, like that (in the older version of the application contacts)

https://mydomain.com/owncloud/remote.php/carddav/

In the new version the link is like this

https://mydomain.com/owncloud/remote.php/dav/addressbooks/

How can i make a rewrite in .htaccess that don’t break the previous rewrite?

I think that this is very important to make compatibility with older versions. ¿Why don put anything like this in this versions of Nextcloud?

Thanks.

OK. I think i got it.

I added this two lines in my .htaccess

RewriteRule /remote.php/dav/addressbooks/users(.*) /remote.php/carddav/addressbooks/$1 [R=301,L]
RewriteRule ^remote.php/carddav https://mydomain.com/owncloud/remote.php/dav/addressbooks/ [R=301,L]

I think that something like this may be added to the code of nextcloud to provide compatibility with older versions of owncloud.

1 Like

Not sure if we should go for a howto-article in the forum, include this in the doc or even put it in the .htaccess by default? @Henni @LukasReschke @JasonBayton

A how to for 11.0.2 and below would be fine. I’ll bookmark this for later :slight_smile: