Old subfolder installation / assurance of former links

Hi, I use nextcloud since few years for some basic file sharing in the family.

I had installed in “domain/nextcloud” and would like to setup a new system, however, as far as I understand, the subfolder setup is not recommeded/supported.

However, i do have quite some photobooks made where the QR codes lead to vidoes as https://domain/nextcloud/s/hash

As I am not an expert I would like to use a “ready do use” setup approach, but have no idea how I can without installation in a subfolder assure the availability of photos/videos with the existing QR codes in my photobooks.

Any proposals ? Your help is really appreciated. I spent quite some time with AIO, script of c-rieger install, nginx reverse proxy, … without getting running …

Btw: I use a ProxMox environment to host my NC instance.

Could forwarding (rewrite in Nginx) from subfolder to subdomain be an option ? I would have no problem to setup my new nextcloud under cloud.domain as long as have an opportunity to still have the QR codes with links to domain/nextcloud being valid

Rewrite is more complicated and maybe did not work, so use redirect.

For example in .htaccess

RewriteEngine On

RewriteRule ^nextcloud/a/b$ https://domain/c/d [R=301,L]

RewriteRule ^nextcloud/e/f$ https://domain/g/h [R=301,L]

A little extra info. If I were you, I would first set up the new Nextcloud in parallel. Nothing will happen until then. It is important that the new Nextcloud is not called domain, but e.g. cloud.domain . This means that both Nextclouds work at the same time. Restore the new Nextcloud with the data from the old Nextcloud. When restoring the database, the shares should still be there, but with a new URL. If this works, you can decommission the old Nextcloud and then install the redirects to the new Nextcloud via .htaccess..

This issue is really killing me.
I installed now NC several times from Scratch (C-Rieger script) and quite some trouble …now its running.
I planned to do the following: Export/Import all the Userprofiles including all photos etc. Unfortunately I have seen the sharing hash is gone :frowning: … so I would need to manually add about 100hashes lateron, but I am willing to do so. Unfortunately the hashes are generated and not the ones in my original nextcloud. I do have the hashes extracted from the “still” old version and planned to edit the MariaDB in Webmin. However, after Webmin Install the Nextcloud is not accessible anymore :frowning: … any hint how I can manually edit the OC_Share table in my nextcloud installation to set the correct hash for the shares to then check if the forwarding from old to new adress will work correctly ?

Unfortunately, I didn’t really understand everything.

Your old NC is no longer working?

But you have the hashes?

You can edit the database either classically at the shell level in MySQL
or, for example, using the phpMyAdmin tool.

The former can possibly be implemented via script, but it depends.

The redirect as i said is no option for you?

The shares were in the old database. You must restore the database in the new Nextcloud. Please same version.

Sorry, for the very unspecific info I shared.

Frustration was overwhelming and I had no time to continue last 3 days.
Ok I got somewhat further.
I installed Nextcloud on Ubuntu24.04 with Nginx and MariaDB. The new folder structure is different then with my old NC installation. Importing Data with Datamigration tool failed.
However, I can still use the data backups on NC clients.
I have therefore, Updated my clients with NC_Old data changed port forwarding to the new local nextcloud server and setup a new user in the new nextcloud. Then copying the data from OldClientData to new and let the system sync it.
By such I do get all my old data into the system. As far as I understand, .htaccess is not to be used for nginx servers.
Therefore, I tried to build my own regex for nginx … but I am very bad at it.
I need to transfer:
https://MyDomain.com/nextcloud/index.php/s/TiEPR5m7GqcrnCt to
https://nextcloud.MyDomain.com/s/TiEPR5m7GqcrnCt but my rule fails:
location = /MyDomain.com/nextcloud/ { rewrite /index.php/$1 /nextcloud.MyDomain.com/?$ redirect; }
nginx -t gives error message, but I do not know, why.

I think if I would be able to solve I could check, if I can import somehow table with the share IDs (like “TiEPR5m7GqcrnCt”) with Webmin to avoid, I need to manually change all IDs after having the required shares newly shared and then the share ID to be changed to match the QR Codes already in my foto books)

Whenever, I get some progress, I also get new issues.
I fail with the redirection:
Even with the rule
rewrite /MyDomain.com/nextcloud/index.php/s/XYZ /nextcloud.MyDomain.com/s/XYZ but it already fails, as the certificate is only considered valid for nextcloud.MyDomain.com not MyDomain.com. I even installed another certificate under MyDomain.com …but really getting lost … this is getting to complex for me

Dear all, after some frustrating weeks I have been able to complete the task, thanks to your hints.
How I solved it:

  1. I installed nextcloud with support of latest C-Rieger script: however, I manipulated the the zero.sh to add “-d MyDomain.X” to the already existing letsencrypt certificat generation. By such I had a certificate for both nextcloud.MyDomain.X and MyDomain.X.
  2. After installation I added the nginx rule (thank you ChatGPT) within location ~ ^/nextcloud/index.php/s/(.*)$ {
    # Forwarding to https://nextcloud.MyDomain.X/s/
    return 301 https://nextcloud.MyDomain.X/s/$1;
    }
    This does the job :wink: … now i only need resync all the accounts with the client datas and need for about 90 entries edit the sharing hash (=$1) with Webmin, as I do not want a sql script. Thank you all for being patient with me and the hint with .htaccess with was going into right direction :wink:
    Item can be closed