Search code examples
phpapachexamppwampwampserver

unable to point different two domains (virtual host) in wamp


in wamp setup, i am unable to set virtual host for my application.

Appache; D:\wamp\bin\apache\apache2.2.8\conf\extra

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

<VirtualHost 127.0.0.1>
DocumentRoot "D:/wamp/www/"
ServerName www.example.org
# ...
</VirtualHost>

<VirtualHost 127.0.0.1>
DocumentRoot D:/wamp/www/facebook_post_style
ServerName www.example.net
ServerAlias *.example.net
# ...
</VirtualHost> 

in host

C:\Windows\System32\drivers\etc\hosts

127.0.0.1        www.example.org
127.0.0.1        www.example.net

I did above configuration. For both domain, same output is displaying.

please check this below URL.enter image description here


Solution

  • try this

    NameVirtualHost *:80
    
    <VirtualHost *:80>
    DocumentRoot "D:\wamp\www\facebook_post_style"
    ServerName www.example.net
    </VirtualHost> 
    
    <VirtualHost *:80>
    DocumentRoot "D:\wamp\www\FolderName"
    ServerName www.example.org
    </VirtualHost>
    

    also make sure you have uncommented the following line from httpd.conf file

    Include conf/extra/httpd-vhosts.conf
    

    check this article for details