I have these two virtual hosts for my development server. I need to send any request to dev. or *.dev. to one application, which will handle dealing with the subdomains. Right now, only the second one works, with any request sent to *.dev. being passed to the application. But if I just go to the dev. subdomain, i get an error in my browser saying the page couldn’t be found. What is going on?
<VirtualHost *>
ServerName dev.redemptionconnect.com
ServerAlias dev.redemptionconnect.com
DocumentRoot "C:/xampp/htdocs/dev.redemptionconnect.com/"
</VirtualHost>
<VirtualHost *>
ServerName sub.dev.redemptionconnect.com
ServerAlias *.dev.redemptionconnect.com
DocumentRoot "C:/xampp/htdocs/dev.redemptionconnect.com/"
</VirtualHost>
Edit: I assume you have defined the subdomain
dev.redemptionconnect.comin DNS? I don’t turn up an address for it.You’ll need DNS records for the first subdomain and each of its sub-subdomains. Defining the sub-subdomains does not implicitly define their parent subdomain as well.
This may be because you are using
dev.redemptionconnect.comin both theServerName andServerAliasdirectives for the firstVirtualHost`, however I wouldn’t expect that to cause an issue.However, since you’re pointing them both to the same application directory do you really need to
VirtualHosts at all? You can just specify multipleServerAlias: