Alias /nextcloud "/var/www/nextcloud"

<Directory /var/www/nextcloud>
  Require all granted
  Options FollowSymlinks MultiViews
  AllowOverride All
  Satisfy Any

  <IfModule mod_dav.c>
    Dav off
  </IfModule>

  SetEnv HOME /var/www/nextcloud
  SetEnv HTTP_HOME /var/www/nextcloud
</Directory>

<Directory /var/www/html>
  <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^\.well-known/host-meta /nextcloud/public.php?service=host-meta [QSA,L]
    RewriteRule ^\.well-known/host-meta\.json /nextcloud/public.php?service=host-meta-json [QSA,L]
    RewriteRule ^\.well-known/webfinger /nextcloud/index.php/.well-known/webfinger [R=301,L]
    RewriteRule ^\.well-known/nodeinfo /nextcloud/index.php/.well-known/nodeinfo [R=301,L]
    RewriteRule ^\.well-known/carddav /nextcloud/remote.php/dav [R=301,L]
    RewriteRule ^\.well-known/caldav /nextcloud/remote.php/dav [R=301,L]
  </IfModule>
</Directory>

<IfModule mod_headers.c>
  Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>
