When using a sub domain it redirects to my default page/domain. This only happens when using HTTPS.. for example
https://forums.example.net
- takes me to example.net ...BUT
http://bans.example.net
- takes me to the bans website (the correct site)
I'm using Apache 2 & Ubuntu 18.04 using my own VPS. ((I also have 2 more sub domains registered to the domain but i think it may be a problem with one of my Apache configs!)) or a Cloudflare problem.
SITES ENABLED CONFIG
RewriteEngine on
RewriteCond %{SERVER_NAME} =bans.example.net [OR]
RewriteCond %{SERVER_NAME} =status.example.net [OR]
RewriteCond %{SERVER_NAME} =example.net [OR]
RewriteCond %{SERVER_NAME} =forums.example.net
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
<VirtualHost *:80>
DocumentRoot /var/www/html/example.net/
ServerName example.net
<Directory /var/www/html/example.net/>
Options +Indexes +FollowSymLinks +MultiViews +Includes
AllowOverride FileInfo Options
Order allow,deny
allow from all
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.net
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/html/bans.example.net/
ServerName bans.example.net
<Directory /var/www/html/bans.example.net/>
Options +Indexes +FollowSymLinks +MultiViews +Includes
AllowOverride FileInfo Options
Order allow,deny
allow from all
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.net [OR]
RewriteCond %{SERVER_NAME} =bans.example.net [OR]
RewriteCond %{SERVER_NAME} =forums.example.net
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
SSL CONFIG INSIDE THE SITES-ENABLED
<IfModule mod_ssl.c>
<VirtualHost *:443>
DocumentRoot /var/www/html/example.net/
ServerName example.net
<Directory /var/www/html/example.net/>
Options +Indexes +FollowSymLinks +MultiViews +Includes
AllowOverride FileInfo Options
Order allow,deny
allow from all
</Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAlias forums.example.net
ServerAlias bans.example.net
ServerAlias status.example.net
SSLCertificateFile /etc/letsencrypt/live/bans.example.net-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/bans.example.net-0001/privkey.pem
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:80>
DocumentRoot /var/www/html/forums.example.net/
ServerName forums.example.net
<Directory /var/www/html/forums.example.net/>
Options +Indexes +FollowSymLinks +MultiViews +Includes
AllowOverride FileInfo Options
Order allow,deny
allow from all
</Directory>
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:80>
DocumentRoot /var/www/html/bans.example.net/
ServerName bans.example.net
<Directory /var/www/html/bans.example.net/>
Options +Indexes +FollowSymLinks +MultiViews +Includes
AllowOverride FileInfo Options
Order allow,deny
allow from all
</Directory>
</VirtualHost>
</IfModule>