I am using WordPress network subdomain setup. I had to put *.mydomain.com as a server alias but now I also have a site subdomain.mydomain.com that leads to another directory. Is there a way of doing this since when I type subdomain.mydomain.com it just loads the WordPress sign up page.

I do have a virtualhost setup for it.


Solution 1:

I'm assuming that you have two VirtualHosts:

  1. VH for WP that hosts *.mydomain.com
  2. VH for independant webiste that hosts subdomain.mydomain.com

Make sure that your subdomain.mydomain.com VirtualHost is loaded or located in file before the VirtualHost with ServerAlias of *.mydomain.com.

Apache will use the 1st VH it finds that matches ServerName/Alias.

Then restart Apache.

Edit:

In file it should be...

<VirtualHost *:80>
  ServerName subdomain.mydomain.com
  ...
</VirtualHost>

<VirtualHost *:80>
  ServerName mydomain.com
  ServerAlias *.mydomain.com
  ...
</VirtualHost>

You can get the default VH and load order by running: httpd -S