When i attempted to configure my virtual host in apache. I put something similar to this,
NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /xampp/htdocs/gift ServerName gift.loc </VirtualHost>
As well as in my hosts file i put something similar to this,
127.0.0.1 localhost 127.0.0.1 gift.loc
And that i run it around the browser,
http://gift.loc - is fine
However when i attempted by using this,
http://localhost/othersite - can't found
Will i skipped somehting to configure? ANy ideas...
Thanks ahead of time,
You'll need a VirtualHost entry for each host you would like apache to deal with. The first within the config file will be utilized for the default if not one other VirtualHosts match the request.
For instance when we have:
<VirtualHost *:80> DocumentRoot /xampp/htdocs/gift ServerName gift.loc </VirtualHost> <VirtualHost *:80> DocumentRoot /example/htdocs/gift ServerName example.com </VirtualHost>
A request foobar.org can get handled through the gift.loc virtual host.
In the docs, it appears like we have to produce a block for every different host that you'd like for everyone.
Further within the same doc, If you're adding virtual hosts for an existing web server, you have to also produce a block for that existing host.