I'm trying to setup a sub domain on my Ubuntu 17.10 machine. I got the HTTPS part working and that shows the right subdomain files, but when I put it as HTTP, it shows the main domain, but I want the HTTP to redirect and show the HTTPS version of the subdomain.
sites-available file:
<VirtualHost *:80>
ServerName forum.domain.com
RewriteEngine on
RewriteCond %{SERVER_NAME} =forum.domain.com
RewriteRule ^ https://forum.domain.com%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName forum.domain.com
DocumentRoot /var/www/forum/html
<Directory /var/www/forum/html>
AllowOverride All
</Directory>
</VirtualHost>
</IfModule>
For some reason the HTTP version is just showing the main port 80 version of the website. I'm using Let's Encrypt for the HTTPS SSL encryption of the website (because it's free) and I've looked over the other conf files to not see any other errors myself
/etc/hosts file:
127.0.0.1 localhost
--.--.--.-- vps141---.vps.ovh.ca vps141---
127.0.1.1 vps141---.vps.ovh.ca vps141---
--.--.--.-- forum.domain.com
I had to take out some numbers so that I don't display my information to everyone viewing sorry :(