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>
3
  • What does "without https://(example.com)" mean exactly? Mar 4, 2017 at 11:27
  • https:// and http://
    – Johnl
    Mar 4, 2017 at 12:47
  • Give concrete text strings what the "without" means, I cannot figure out from your reply what exactly is meant by them. Mar 4, 2017 at 16:28

1 Answer 1

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>
1
  • You are welcome. Why don't you accept the answer?
    – rda
    Mar 4, 2017 at 18:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .