OwnCloud how to setup in subfolder?

Hi All,

I want to collect all my apps under the one domain name (like server.com/app1, server.com/app2, server.com/cloud etc) and to have one HTTPS-driven portal. OwnCloud is the latest one which still operates under the own domain name. So, my goal is to move it to /cloud subdirectory. I have one DocumentRoot = /var/www/html, ownCloud is configured to use Directory + Alias:

DocumentRoot /var/www/html
Alias /cloud /var/www/owncloud
<Directory /var/www/owncloud>
    Options +FollowSymLinks
    AllowOverride All
    Require all granted

    <IfModule mod_dav.c>
        Dav off

    SetEnv HOME /var/www/owncloud
    SetEnv HTTP_HOME /var/www/owncloud

    XSendFile On
    XSendFilePath /var/tmp

Steps to reproduce

When I open https://server.com/cloud browser redirects me to https://server.com/cloud/login but shows me File not found. And that’s it. What I missed?

Expected behaviour

To make it working under the https://server.com/cloud URL

Actual behaviour

Correctly works only under the https://cloud.server.com URL

Server configuration

Operating system:
CentOS 8 Stream

Web server:
Apache 2.4

PostgreSQL 14.4

PHP version:

ownCloud version: (see ownCloud admin page)

The content of config/config.php:

'debug' => false,
'instanceid' => 'instanceid',
'passwordsalt' => 'passwordsalt',
'secret' => 'secret',
'trusted_domains' => 
  array (
    0 => 'locahost',
    1 => 'server.com',
'datadirectory' => '/var/lib/owncloud',
'overwrite.cli.url' => 'https://server.com/cloud',
'dbtype' => 'pgsql',
'version' => '',
'dbname' => 'owncloud',
'dbhost' => 'localhost:5432',
'dbtableprefix' => 'oc_',
'dbuser' => 'oc_admin',
'dbpassword' => '123454565465567425442565464565454254',
'installed' => true,
'mail_smtpmode' => 'smtp',
'mail_from_address' => 'from',
'mail_domain' => 'server.com',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtphost' => 'server.com',
'mail_smtpport' => '587',
'theme' => '',
'maintenance' => false,
'forcessl' => true,
'forceSSLforSubdomains' => true,
'mail_smtpauth' => 1,
'mail_smtpname' => 'mailer',
'mail_smtppassword' => '****************',
'mail_smtpsecure' => 'tls',
'loglevel' => 3,
'trashbin_retention_obligation' => 'auto',
'asset-pipeline.enabled' => true,
'htaccess.RewriteBase' => '/',
'updatechecker' => false,
'versions_retention_obligation' => 'disabled',
'filelocking.enabled' => true,
'memcache.local' => '\\OC\\Memcache\\APCu',
'memcache.locking' => '\\OC\\Memcache\\APCu',
'allow_user_to_change_mail_address' => '',

Solution is to set RewriteBase in OWNCLOUD_HOME/.htaccess:

RewriteBase /cloud

Everything works as expected now.

1 Like