Moving url from /cloud/ to /

Hi,

I am using 19.0.3 and migrated the server from old one to the new one which worked fine.

Also I decided to change the path from whatever.com/cloud/ to whatever.com/ which worked fine too.
But I have a problem with the android-apps. It will not show any files/folders/activitys and so on.

I could use an redirect but this does only work in the browser, in the android app no content will be shown.
So I tried to use .htaccess rewrite rules but using whatever.com/cloud/ in the browser I will only get “The requested URL was not found on this server.” for /cloud/index.php and “You don’t have permission to access this resource.” for just /cloud/. I checked the credentials, owner of .htaccess is www-data and the user has full access.

the .htaccess in the folder /var/www/html/cloud for now (I tried a lot but as I see in google this should work, I also tried the " From Old to New (internal)" example from https://httpd.apache.org/docs/2.4/rewrite/remapping.html ):

RewriteEngine on
RewriteRule ^/cloud/(.*) /$1 [PTL]

In /etc/apache2/apache2.conf I am already using “AllowOverride All” in Directory / and /var/www/ without success. Using “AllowOverride None” for /var/www I will get the /.well-known/caldav and /.well-known/carddav warning in the nectcloud Overview, so it seems that the rewrite from /var/www/html(.htaccess are working fine. I also tried to add the rewrite rule into this .htaccess without success too.

Nextcloud version: 19.0.3
Operating system and version: Ubuntu 20.04
Apache or nginx version: Apache/2.4.41
PHP version: 7.4

Kind regards

Please do not change the nextcloud file .htaccess . Please only control the apache2 virtual host configuration and in nextcloud config/config.php .

If you use the path /cloud but you want direct use / of your domain i think you must modify your apache2 config and set the correct path to /cloud . Perhaps you must also change something in your nextcloud configuration.

Hi devnull,

I did not found any docu how to do that, so I just download the original nextcloud files and restored the data, db and config.php (in the config.php I changed the path). After that I needed to reinstall all apps (deactivate -> download and install) because they were not installed. I did it that way because I found too many /cloud references espacially in the app-folder.
That worked great.

But not for the android apps (I am only using andorid, maybe the iOS app would have issues too)

The .htaccess change from nextcloud was only a test if it would change someting, I would like to do that in a own .htaccess file.

This webserver is only for nextcloud, so I am no using any virtualhost, the files are in /var/www/html/.

So my question is, how am I able to redirect the whatever.com/cloud to whatever.com/ internally in apache?
Othervise I would need to create new profiles on all family phones or change it back to /cloud/

In apache2 you must use virtual hosts. Normally there there is a virtual host 000-default.conf for whatever.com and www.whatever.com and you set a virtual host for e.g. “nextcloud.conf” for cloud.whatever.com .
If you only want to use your domain whatever.com you must correctly set 000-default.conf and 000-default-le-ssl.conf . I think you must correctly set “DocumentRoot”. Path must end with …/cloud". After that restart your apche2 webserver.

Hi devnull,

as I wrote, my problem is not changing the path (worked perfect!) but providing the clients a way to use the nextcloud with the old path without changing the profile (remove and readd profile).
So, yes there is the 000-default.conf but its the default-file.

For Browsers using whatever.com/cloud it´s easy via simple http-redirect to whatever.com/ but its not working for the app. The app just ignores the HTTP-redirect. :confused:

Kind regards

Hi,

I got it (nearly 100%). For me good enough.

Just to document it what I did from the beginning.

  1. start maintanance window on Server https://whatever.com/cloud/index.php (set maintanance true in /var/www/html/cloud/config/config.php)
  2. backup DB, config/config.php and data-folder
  3. install new server (ubuntu 20.04) and install LAMP, create database and set the php.ini values (memory and so on) and set “AllowOverride All” in /etc/apache2/apache2.conf within the “<Directory /var/www/>” block. Only you as admin should be able to connect to this server.
  4. restore database
  5. download nextcloud (the same version as the server before) and extract it in /var/www/html/ (so the index.php is at /var/www/html/index.php)
  6. restore data-folder
  7. restore config.php (and change the path and maintanance mode)
  8. login to https://whatever.com/index.php => this should work now
  9. You will see, there isn´t any additional app installed. Go to apps. You will see that the apps which should be installed are not shown as installed but when you search in the categories like organization they are shown as “deactivate” and not “download and install” => deactivate it and install it again. You will see, the apps are working as before :slight_smile:
  10. @devnull: this was your hint: in /etc/apache2/sites-enabled/000-default.conf add the following lines within the standard VirtualHost:
    RewriteEngine on
    RewriteRule “^/cloud/(.*)” “/$1” [L]
    RewriteRule “^/cloud” “/index.php” [L]
    RewriteRule “^/cloud/” “/index.php” [L] # not working, do not know why.
  11. restart apache2

whatever.com/cloud and whatever.com/cloud/index.php are working, the android app (tested: browsing and sync files, auto upload, activities, photos) is working without issues.
whatever.com/cloud/ is not working. I have no idea why but I hope nobody will open this path ^^

I am sure that this isn´t best practice (I am open for feedback) but it worked and it should work for any other path-change.

Kind regards

1 Like

Nice

Ok path is /var/www/html/nextcloud

I think this must work, too.