Using The Nextcloud External Sites App As The Default App

Using Nextcloud ‘External Sites' app as the default app.

Issue: When trying to set the default app of Nextcloud to the root folder (https://my.site.com) via the ‘External Sites' app, the app would add an id ( {id} ) to the end of the url that would cause a conflict with the default app setting in config.php. To eliminate the External Sites app id, the code below was changed below:

Original file at: /var/www/html/nextcloud/apps/external/appinfo/routes.php

$ sudo nano /var/www/html/nextcloud/apps/external/appinfo/routes.php
$this->create('external_index', '/{id}')
	->actionInclude('external/index.php');
$this->create('external_ajax_setsites', 'ajax/setsites.php')
	->actionInclude('external/ajax/setsites.php');

Changed to:

$this->create('external_index', '')
	->actionInclude('external/index.php');
$this->create('external_ajax_setsites', 'ajax/setsites.php')
	->actionInclude('external/ajax/setsites.php');

The only change is the deletion of the ‘/{id}' parameter in the first line.

This creates a default link to https://my.site.com/nextcloud/apps/external/?id=1

This also creates a redirect from https://my.googulife.com/nextcloud/apps/external/
to
https://my.site.com/nextcloud/apps/external/?id=1
and alllows the code below to work – Place in the config.php file to work:

ref: https://docs.nextcloud.com/server/9/admin_manual/configuration_server/config_sample_php_parameters.html

$ sudo nano /var/www/html/nextcloud/config/config.php

I added the line before the line with ‘redis' => …

'defaultapp' => 'external',

Note that by doing this, you can still add additional sites to the ‘External Sites' app however, the first site (../?id=1) will be the the site that is set to the default app by using the code snippet above.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.