I'm setting up a new example and putting it on a virtual host Apache server (Ubuntu 18.04). I'm having some issues with the Apache configuration because I'm not too familiar with them.
http://example.com, http://www.example.com, https://www.example.com all serve the correct website in its document root.
However, https://example.com serves the document root from main-example.org.
I have also installed an SSL certificate recently and been told to use port 443? It still comes up as "Connection not sure" so I was wondering if this were the case?
Here is the config file in apache2/sites-available:
<VirtualHost *:80>
ServerName main-example.org
ServerAlias www.main-example.org
ServerAdmin it@main-example.org
DocumentRoot /var/www/main-example/build
ErrorLog /var/www/main-example/error_test.log
CustomLog /var/www/main-example/access_test.log combined
<Directory "/var/www/main-example">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ServerAdmin it@example.com
DocumentRoot /var/www/example
ErrorLog ${APACHE_LOG_DIR}/error_test.log
CustomLog ${APACHE_LOG_DIR}/access_test.log combined
<Directory "/var/www/example">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com [OR]
RewriteCond %{SERVER_NAME} =main-example.org [OR]
RewriteCond %{SERVER_NAME} =www.main-example.org
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
Thanks for your help!