I am trying to replicate the setup I have a remote server on my local server/machine, that is, having wildcard subdomains with the following virtual hosts in place.
<VirtualHost *:80> DocumentRoot "/Users/User/Sites/tbi" ServerName tbi.loc </VirtualHost> <VirtualHost *:80> DocumentRoot "/Users/User/Sites/tbi" ServerName subdomains.tbi.loc ServerAlias *.tbi.loc </VirtualHost>
This setup doesn't seem to work. I do have access to http://tbi.loc, but I cannot connect to any subdomains. What I aim to accomplish is having the www subdomain for non-registered visitors and a separate subdomain for each registered user.
The document root for both virtual hosts is the same (I have tried using different document roots to no avail) since I determine what needs to happen based on the subdomain.
Please, note that I would like to accomplish this without having to rely on .htaccess (if at all possible).
The Apache hosts file contains two entries for this virtual host.
127.0.0.1 *.tbi.loc 127.0.0.1 tbi.loc