Htaccess locks me out when installing on virtualhost

Hi!
I am installing Nextcloud locally in my lampstack under Linux Mint. If I place Nextcloud under localhost (localhost/nextcloud) everything works fine. But my aim is to run Nextcloud under a virtualhost that I have set up, nextcloud.example.com. The virtualhost works with bitnami’s “demo app files” but when I replace them with the contents of the Nextcloud folder I am blocked out by Nextcloud’s .htaccess when pointing the browser to the install page.

If I remove the snippet below then I can access the page with the install script (I have not tried running it).

Do I need to add something related to my virtualhost so that it is not blocked?

Thanks in advance!

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteRule ^\.well-known/host-meta /public.php?service=host-meta [QSA,L]
  RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L]
  RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
  RewriteRule ^remote/(.*) remote.php [QSA,L]
  RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
  RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*
  RewriteRule ^(?:\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>

Could you share your entire Apache VirtualHost file that you made for this?

Hi @levlaz
Thanks for your reply!
I don’t know if it is relevant or not but since I am using Bitnami Lampstack I did not make the virtualhosts configuration globally in Apache, but only for the Nextcloud app in the file:
/home/peter/lampstack/apps/nextcloud/conf/httpd-vhosts.conf:

<VirtualHost *:8080>
  ServerName nextcloud.ecureuil.io
  DocumentRoot "/home/peter/lampstack/apps/nextcloud/htdocs"
  Include "/home/peter/lampstack/apps/nextcloud/conf/httpd-app.conf"                                                                                           
</VirtualHost>

Other Bitnami config files involved are:

/home/peter/lampstack/apps/nextcloud/conf/httpd-app.conf

<Directory "/home/peter/lampstack/apps/nextcloud/htdocs">
    Options Indexes MultiViews
    AllowOverride All
    <IfVersion < 2.3 >
    Order allow,deny
    Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
    Require all granted
    </IfVersion>
</Directory>

/home/peter/lampstack/apps/nextcloud/conf/httpd-prefix.conf

Alias /nextcloud/ "/home/peter/lampstack/apps/nextcloud/htdocs/"
Alias /nextcloud "/home/peter/lampstack/apps/nextcloud/htdocs"
Include "/home/peter/lampstack/apps/nextcloud/conf/httpd-app.conf"

And globally for Bitnami:
/home/peter/lampstack/apache2/conf/bitnami/bitnami-apps-vhosts.conf

#Bitnami applications installed in a Virtual Host
Include "/home/peter/lampstack/apps/nextcloud/conf/httpd-vhosts.conf"

/home/peter/lampstack/apache2/conf/bitnami/bitnami.conf (but I have not changed/added anything in this default config)
# Default Virtual Host configuration.

<IfVersion < 2.3 >
  NameVirtualHost *:8080
  NameVirtualHost *:8443
</IfVersion>

<VirtualHost _default_:8080>
  DocumentRoot "/home/peter/lampstack/apache2/htdocs"
  <Directory "/home/peter/lampstack/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    <IfVersion < 2.3 >
      Order allow,deny                          
      Allow from all
    </IfVersion>
    <IfVersion >= 2.3 >
      Require all granted
    </IfVersion>
  </Directory>

  # Error Documents
  ErrorDocument 503 /503.html

  # Bitnami applications installed with a prefix URL (default)
  Include "/home/peter/lampstack/apache2/conf/bitnami/bitnami-apps-prefix.conf"
</VirtualHost>

# Default SSL Virtual Host configuration.

<IfModule !ssl_module>
  LoadModule ssl_module modules/mod_ssl.so
</IfModule>

Listen 8443
SSLProtocol all -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !EDH !RC4"
SSLPassPhraseDialog  builtin
SSLSessionCache "shmcb:/home/peter/lampstack/apache2/logs/ssl_scache(512000)"
SSLSessionCacheTimeout  300

<VirtualHost _default_:8443>
  DocumentRoot "/home/peter/lampstack/apache2/htdocs"
  SSLEngine on
SSLCertificateFile "/home/peter/lampstack/apache2/conf/server.crt"
SSLCertificateKeyFile "/home/peter/lampstack/apache2/conf/server.key"
            
  <Directory "/home/peter/lampstack/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    <IfVersion < 2.3 >
      Order allow,deny                          
      Allow from all
    </IfVersion>
    <IfVersion >= 2.3 >
      Require all granted
    </IfVersion>
  </Directory>

  # Error Documents
  ErrorDocument 503 /503.html
        
  # Bitnami applications installed with a prefix URL (default)
  Include "/home/peter/lampstack/apache2/conf/bitnami/bitnami-apps-prefix.conf"
</VirtualHost>

# Bitnami applications that uses virtual host configuration
Include "/home/peter/lampstack/apache2/conf/bitnami/bitnami-apps-vhosts.conf"

Problem solved. Needed Options +FollowSymLinks for the location of nextcloud.