Overwrte.cli.url does not work

Steps to reproduce
1. Normal installation of owncloud 9.1 on Debian. I created two conf files in the sites-available directory of apache: one for my subdomain and one for the main domain.

Expected behaviour
The user should access the cloud webpage through the subdomain.

Actual behaviour
The subdomain redirects to the main domain.

Server configuration
Operating system: debian 8.7
Web server: 2.4.10-10+de
Database: mariadb-server 10.1.21+mari
PHP version: php5 5.6.29+dfsg-
owncloud: 9.1.3-1.1
Special configuration (external storage, external authentication,
reverse proxy, server-side-encryption):
external storage, external authentifcation and server-side-encryption
enable

Comment
On my former server, owncloud was in a folder which name was sub.domain.ltd. It used to work. Now, I install on my new server and the subdomain redirects to the main domain.

My config:

<?php
$CONFIG = array (
  'updatechecker' => false,
  'instanceid' => 'octg8xzbc7wj',
  'passwordsalt' => 'EBsyvBmoxXbsVhFW/7DJ+yVhGmq+Hd',
  'secret' => 'ZFxLuWUkRGHopiLXQPMqAQHTFAYxinx0fu3rIwQcD1/0c5Cg',
  'trusted_domains' => 
  array (
    0 => 'IP',
    1 = > 'cloud.domain.ltd',
  ),
  'datadirectory' => '/var/www/owncloud/data',
  #'overwrite.cli.url' => 'http://IP/owncloud',
  'overwrite.cli.url' => 'http://cloud.domain.ltd',
  'dbtype' => 'mysql',
  'version' => '9.1.3.1',
  'dbname' => 'owncloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_tchokapix1',
  'dbpassword' => 'RFy5/vX0GUpctdx8RMZ5s2/zp75/QN',
  'logtimezone' => 'UTC',
  'installed' => true,
);

If I tell the config.php to overwrite the ip of the localhost, I can access my cloud throught the following address: http://IP/owncloud.
The two apaches configuration files show Documentroot (cloud.domain.ltd.conf points to the folder of my cloud and domain.ltd.conf points to the folder of my blog).

Hi,

please see the description of overwrite.cli.url in the config.sample.php. This option doesn't do what you're currently expecting.

Redirecting within domains / subdomains and which domain is accessible via your webserver is the job of your webservers config, not ownCloud.

There is my configuration for my webser:

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerAdmin webmaster@cloud.domain.ltd
    ServerName cloud.domain.ltd
ServerAlias cloud.domain.ltd
DirectoryIndex index.html index.php
Alias /owncloud "/var/www/cloud.domain.ltd"
DocumentRoot /var/www/owncloud/
<Directory  /var/www/owncloud/>
Options +FollowSymlinks
    AllowOverride All
    #Satisfy Any
 <IfModule mod_dav.c>
   Dav off
    </IfModule>
 SetEnv HOME /var/www/owncloud/
 SetEnv HTTP_HOME /var/www/owncloud/
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =cloud.domain.ltd
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet]

Hi,

i think its the best to get help with apache configuration issues at communities like http://www.apachelounge.com/ Those have more knowledge about webservers and can ask better questions helping you to solve such issues.

Their forum is pretty dead and they are not very helpful.

EDIT: the SSL certificate was wrong.
I saw the error with apachectl -S. Then, I saw the origin of the error in the SSL certificate. I corrected it and now it works.