Moving entire NextCloud folder location

Hi!

I am on a shared hosting plan, so I might be limited about my options.

Currently, my NextCloud installation had been done directly into .../public_html/, but I would like to move it to .../public_html/nextcloud/ because I have other folders and files and it interferes with files validation.

I know I could just move everything and create a redirection, but maybe there are other concerns I didn’t think about. So, I’d like to ensure the procedure with someone. I searched, but I only found how to move the data folder, but it is the software itself I want to move, but still keeping it working as root.

So,

  • .../public_html/my_own_folder/file1.txt would be downloadable.
  • .../public_html/my_own_folder/ would be listable.
  • .../public_html/ would be an URL rewrite for .../public_html/nextcloud/.

Maybe I could skip the last one and only having a simple index to index redirect and add a subdomain that would point to NextCloud.

But anyhow, your suggestions on this are welcome, I would like to ensure moving the software won’t break anything.

Take a look at this guide HowTo: Change / Move data directory after installation regarding data location.
the application part should be less critical as long you configure your web server right…

What @wwe said is relevant to the data directory, but you’re also talking about moving the app installation directory and changing the external URLs (which will have implications to client apps).

Honestly it may be easier/safer to move your non-NC stuff to a subdomain/elsewhere and leave NC where/how it is.

You have options. Just tossing another out there. Depends on which battles you’d prefer to fight.

@jtr Thank you for your option, but I have things pointing there that could be used by others. So, in fact, it is easier to change NextCloud as I am the only one to use it.

@wwe Well, as I said, I was already aware of this guide and others explaining how to move the data folder. That’s good, but not what I want.

Finally, I moved yesterday the files without adding any redirections and I add a subdomain pointing to this subfolder.

The folder address works: mydomain.com/nextcloud
But, nextcloud.mydomain.com doesn’t: the login page only loops.

Moreover, even in the subfolder URL, within the admin section, the overview tells me there are issues with /.well-known/ URLs. I already add a redirection, but it doesn’t work. I will probably be able to fix this one.

The main issue is the other one: using a subdomain, the login page loops.

Did you do the redirection this way, by adding this rules to …/public_html/.htaccess?

  <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^\.well-known/webfinger https://%{SERVER_NAME}/nextcloud/index.php/.well-known/webfinger [R=301,L]
    RewriteRule ^\.well-known/nodeinfo https://%{SERVER_NAME}/nextcloud/index.php/.well-known/nodeinfo [R=301,L]
    RewriteRule ^\.well-known/carddav https://%{SERVER_NAME}/nextcloud/remote.php/dav/ [R=301,L]
    RewriteRule ^\.well-known/caldav https://%{SERVER_NAME}/nextcloud/remote.php/dav/ [R=301,L]
  </IfModule>

I don’t know which .well-known urls he complains about, you can try what works and what calms the admin panel
I hope this helps.

The “.well-known” issue is fixed. I had to remove the front slash of the redirections in .../nextcloud/.htaccess and having my root htaccess:

RewriteEngine On
RewriteRule ^\.well-known/(.*)$ nextcloud/.well-known/$1 [R=302,NC,L]

Unfortunately, the subdomain login issue was not fixed by my change. The 302 will be changed when everything will be fine. I’ll probably have to dig in the code.

1 Like

I don’t know exactly where the issue was located, but now it works.

I decided to open a new private browser and both adresses worked. So I ensured to cache was disabled in my testing browser page, still not. I closed and reopened and now it works. Maybe a Chrome issue then, but not quite sure.