Well,
I know how to do virtual hosts, but on windows it looks harder to get what i want to.
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:/wamp/www/domaindev_com/public"
ServerName domaindev.com
ServerAlias *.domaindev.com
ErrorLog "logs/domaindev_com-error.log"
CustomLog "logs/domaindev_com-access.log" common
</VirtualHost>
And my hosts file:
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
127.0.0.1 localhost
192.168.0.1 domaindev.com
192.168.0.1 www.domaindev.com
C:\Documents and Settings\B>ping domaindev.com
Pinging domaindev.com [192.168.0.1] with 32 bytes of data:
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 192.168.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:\Documents and Settings\B>ping www.domaindev.com
Pinging www.domaindev.com [192.168.0.1] with 32 bytes of data:
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 192.168.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
So it looks like it works. But when i try to use the www.domaindev.com in my browser i get a time out or a dns failure...
Any ideas ? Is the ServerAlias option wrong ?
EDIT: Only the domaindev.com is working
Have you tested changing the
ServerAlias
directive to the absolute URLwww.domaindev.com
and trying that?Your browser may have also cached the failed DNS request and hasn't tried it again - usually killing all browser sessions will help with that.
These configuration files are on a server, right? And the browser you're trying to load it up in is on your personal machine, not the server? Because, see, when you put
192.168.0.1 www.domaindev.com
in the hosts file, it only makes it resolve on that machine, not any other. Try putting it in your workstation's hosts file too.Can you access the site via domaindev.com? via the ip address? If you can't it's not a resolution problem but an apache config/startup problem as the server is not running.
Do you have any active proxy configuration in your webbrowser? Try to deactivate the proxy. Sometimes the command "ipconfig /flushdns" exectued in a command prompt helps.
Have you already tried to connect to your website with "domaindev.com"? If this works than you have to change your ServerAlias directive to an fqdn. http://httpd.apache.org/docs/2.0/mod/core.html#serveralias