1

We have enabled ssl to a website. If we enter "https://example.com/" (with htpps://), it pointing to the right folder. Without https://(example.com) its pointing to the root folder(/var/www/html). How to point both to the right folder "/var/www/html/example.com/public_html"?

.conf as follows

<Directory /var/www/html/example.com/public_html>
    Require all granted
</Directory>

<VirtualHost xx.xx.xx.xx:443>
        SSLEngine On
        SSLCertificateFile /etc/apache2/ssl/example.crt
        SSLCertificateKeyFile /etc/apache2/ssl/example.key
        SSLCACertificateFile /etc/apache2/ssl/example.cer

        ServerName example.com
        ServerAlias www.example.com
        ServerAdmin test@example
        DocumentRoot /var/www/html/example.com/public_html

        ErrorLog /var/www/html/example.com/logs/error.log
        CustomLog /var/www/html/example.com/logs/access.log combined

</VirtualHost>
Johnl
  • 11
  • 1

1 Answers1

0

Adding the follollowing to the config should do it (unless the ServerName or ServerAlias directives with value example.com is already defined somewhere earlier in a VHost):

<VirtualHost *:80>
        ServerName example.com
        ServerAlias www.example.com
        ServerAdmin test@example
        DocumentRoot /var/www/html/example.com/public_html
        ErrorLog /var/www/html/example.com/logs/error.log
        CustomLog /var/www/html/example.com/logs/access.log combined
</VirtualHost>
rda
  • 1,887
  • 1
  • 12
  • 20