I have the following VirtualHosts inside /etc/httpd/sites-enabled/domain.com.conf:
<VirtualHost *:80>
DocumentRoot /var/www/html/
ServerName www.domain1.com
</VirtualHost>
<VirtualHost *:80>
ServerName test.domain2.com
ServerAdmin [email protected]
DocumentRoot /var/www/html/domain2dir
ErrorLog /var/log/httpd/domain2.com-error.log
CustomLog /var/log/httpd/domain2.com-access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName something.domain1.com
ServerAdmin [email protected]
DocumentRoot /var/www/html/somethingdir
ErrorLog /var/log/httpd/something.domain1.com-error.log
CustomLog /var/log/httpd/something.domain1.com-access.log combined
</VirtualHost>
When I access my server via IP, it shows me /var/www/html/; [OK]
When I access my server via something.domain1.com, it shows me/var/www/html/somethingdir; [OK]
But when I access test.domain2.com, it returns me to http://IP/ instead of taking me to /var/www/html/domain2dir.
Why is that?
PS: domain2dir is a wordpress site.
EDIT: I changed DocumentRoot /var/www/html/domain2dir to something other than domain2dir and it works. I think this means that the problem is the wordpress directory, but I'm not sure why.
Running CentOS 7 with Apache 2.4.6 and PHP 7.2.9.