Installing into a subdirectory but serviing from domain's web root

ahoy all,

is it possible to install Nextcloud into a subdirectory of the web root e.g. /var/www/nextcloud but have it be served as if it lives in the web root e.g. /var/www ? in other words the Nextcloud install will be accessed via https://cloud.example.org though it is actually installed at https://cloud.example.org/nextcloud ? in my particular case i have to use an .htaccess file as i cannot edit the main config of the Apache server.

i have done this many times with other websites (static, WordPress, etc) via redirects in .htaccess files as described here. however it seems to be something particular with Nextcloud that prevents it from working. i have also tried setting in config.php the following options

'overwritewebroot' => '/nextcloud',
'overwrite.cli.url' => 'https://cloud.example.com/',
'htaccess.RewriteBase' => '/nextcloud',

as discussed in some possibly related issues but no luck.

so after much research and trials i am beginning to think that this seemingly simple installation profile is not currently possible with Nextcloud?

thanks.

PS: my .htaccess files included below

# .htaccess
RewriteEngine on

# forward to nextcloud
RewriteBase /nextcloud

# always HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# transparently redirect all request to this directory to a subdirectory
# based on https://help.dreamhost.com/hc/en-us/articles/216109967-Transparently-redirect-your-root-directory-to-a-subdirectory

## Rewrites all URLS without subdirectory in them
RewriteCond %{REQUEST_URI} !^/nextcloud/

## Rewrite all those to /folder
RewriteRule ^(.*)$ /nextcloud/$1 [L]

I am using:

RewriteEngine on
RewriteBase /

Rewrites all URLS without blog in them

RewriteCond %{REQUEST_URI} !^/nextcloud/

Rewrites all URLS [Replace “example” with the actual domain, without the TLD (.com, .net, .biz, etc)]

RewriteCond %{HTTP_HOST} ^(www.)?domain.

Rewrite all those to insert /folder

RewriteRule ^(.*)$ /nextcloud/$1 [L]

Let me know if you get errors using this

@misterlindsey thank you for the follow up. i tried your suggestion, which seems basically the same as my original attempts, but still no luck. i ended up with the familiar page

Internal Server Error

The server was unable to complete your request.

If this happens again, please send the technical details below to the server administrator.

More details can be found in the server log.
Technical details

Remote Address: 111.111.111.111
Request ID: Xo-AhCjyZZDnhI6TIvZ4mAAAAAQ

and in the log i found the following errors:

{"reqId":"Xo-AhCjyZZDnhI6TIvZ4mAAAAAQ","level":3,"time":"2020-04-10T00:40:36+00:00","remoteAddr":"108.36.211.83","user":"--","app":"index","method":"GET","url":"/nextcloud/index.php","message":{"Exception":"Exception","Message":"The requested uri(/) cannot be processed by the script '/nextcloud/index.php')","Code":0,

{"reqId":"Xo-AhCjyZZDnhI6TIvZ4mAAAAAQ","level":3,"time":"2020-04-10T00:40:36+00:00","remoteAddr":"108.36.211.83","user":"--","app":"no app in context","method":"GET","url":"/nextcloud/index.php","message":{"Exception":"Symfony\\Component\\Routing\\Exception\\RouteNotFoundException","Message":"Unable to generate a URL for the named route \"forms.page.index\" as such route does not exist.","Code":0,

{"reqId":"Xo-AhCjyZZDnhI6TIvZ4mAAAAAQ","level":3,"time":"2020-04-10T00:40:36+00:00","remoteAddr":"108.36.211.83","user":"--","app":"no app in context","method":"GET","url":"/nextcloud/index.php","message":{"Exception":"Symfony\\Component\\Routing\\Exception\\RouteNotFoundException","Message":"Unable to generate a URL for the named route \"photos.page.index\" as such route does not exist.","Code":0,

at this point i, like the others to which i linked to before, seem pretty lost as to how we can do this. yet it also seems like it should be fairly straightforward, so maybe there is a lurking bug?

thanks