Why does apache always redirect to the default VirtualHost?

Im using apache 2.4 on centOS7.6 and I want to have one subdomain and the main domain, both showing different content. I have two VirtualHosts configured, both in different files in /etc/httpd/conf.d/

example.com.conf

<VirtualHost *:80>     ServerName example.com     DocumentRoot /var/www/html/example.com/ </VirtualHost> 

and subdomain.example.com

<VirtualHost *:80>     ServerName subdomain.example.com     DocumentRoot /var/www/html/subdomain.example.com/ </VirtualHost> 

The problem is, no matter which domain i go to, i get the file from the default VirtualHost, which is the alphabetically first one. I tried changing the permissions of /var/www/ to 777, disabling selinux, switching the os to fedora30 and a few minor things.