Virtual Host 64bits Windows 7

64-bitapache-2.2windows 7xampp

I have problem…. 😀
How to create a virtual host on 64bits W7?????
In 32 bits it was enough to add e.g.

<VirtualHost localhost/Story>
<Directory "C:/xampp/htdocs/Story/public">
Options FollowSymLinks
AllowOverride All
</Directory>

DocumentRoot C:/xampp/htdocs/Story/public
ServerName localhost/Story
CustomLog C:/xampp/htdocs/Story/log combined
</VirtualHost>

And in system32 in hosts:
127.0.0.1 localhost/Story

But in 64bits it is ignoring :/ What I should do?


Ok more datails:

In my apache conf file I have:

<VirtualHost localhost/Story>
<Directory "C:/xampp/htdocs/Story/public">
Options FollowSymLinks
AllowOverride All
</Directory>

DocumentRoot C:/xampp/htdocs/Story/public
ServerName localhost/Story
CustomLog C:/xampp/htdocs/Story/log combined
</VirtualHost>

In my C:\Windows\System32\drivers\ect\hosts
127.0.0.1 localhost/Story

In my Netbeans prooject run path is set:

http://localhost/Story/

So I think now if I run my project he will use this configured localhost/Story virtual host and should automatically redirect my application to C:/xampp/htdocs/Story/public because I have configured this virtual host in my httpd.conf file. Am I right?

On my another laptop where is 32bits system this configuration is working and when I write:
localhost/Story my application is working because this virtual host redirect it to the public folder. On 64 bits system when I write localhost/Story I see only tree of files that means my virtual host is not working correctly :/ But I can not understand why:/

Best Answer

If, and absolutely If, this ever worked it was absolutely not valid. Neither is localhost/story a valid hostname nor is the Configuration valid since the apache documentation states that the Directive takes one argument addr which can be:

  • The IP address of the virtual host;
  • A fully qualified domain name for the IP address of the virtual host;
  • The character *, which is used only in combination with NameVirtualHost * to match all IP addresses; or
  • The string _default_, which is used only with IP virtual hosting to catch unmatched IP addresses.

You are using an URI including a path, but omitting the protocol.

Update

Regarding the points above you should clearly see that, either you made a weird mistake or you might not have fully understood the concepts of HTTP (especially HTTP/1.1) and Virtualhosting. You might have been missing even some points about networking in basics.

That's no problem since there are lots of good resources to learn from. What might be working (at least it should be valid):

NameVirtualHost *

<VirtualHost localhost>
    <Directory "C:/xampp/htdocs/Story/public">
       Options FollowSymLinks
       AllowOverride All
    </Directory>

    DocumentRoot C:/xampp/htdocs/Story/public
    ServerName localhost
    CustomLog C:/xampp/htdocs/Story/log combined
</VirtualHost>
Related Topic