Nextcloud version: Nextcloud Hub II (23.0.1 RC3)
Operating system and version: Ubuntu 20.04
Apache or nginx version: Apache 2.4.25
PHP version: 7.4
The issue you are facing:
We have more than 200 sharing links. We had to migrate nextcloud on a different server with different lan IP and hostname and we lost access to the folders through those links.
Any chance to bulk modify the path in links database or fix that issue without renaming links one by one ?
You have a share table. But there is no hostname. If you create a new share, is it working with the new hostname? And then you can check the difference with the old shares in the table.
There’s no way around using the new “hostname”, respective the new (sub.)domain.name if you changed it in your web server and Nextcloud config. The “…/s/m4PGe879bx578y” part of the links should stay the same but your users have to use the new hostname in front of it, like that: https://newhostname/s/m4PGe879bx578yE
But why did you change the domain name in the URL in the first place? Normaly you would just point the DNS records for cloud.domain.tld or cloud.tld to the new IP (A record) or to the hostname of the new server (CNAME) when you migrate web applications like Nextcloud to a new server…
If you’re using the IP address of the server in order to access your Nextcloud there is no way to preserve the links when you migrate Nextcloud to a server with another IP address. The only way would be using a DNS name and then point that name to the IP address of the new server. Obviously such a DNS setup would have to be already in place before the migration.
Host name change … old lshare links are directed to the wrong hostname. Game over. Even with some tricky rewrite direction rules…
It was anyway an interesting question, so I did try some rewrite rules on my test bench… Always end up crashing… Even for old links using sharerenamer app …
Maybe a bit offtopic, but I would always use hostnames for your Nextcloud. It is easier to remember, if you move to a different ip, there is no problem, and you can get ssl certificates.