: Apache virtual host problem on windows 7 - please explain This problem has never occurred in the past (i have tried this many times) but this time, ALL virtual hosts defined in the virtual-hosts.conf
This problem has never occurred in the past (i have tried this many times) but this time,
ALL virtual hosts defined in the virtual-hosts.conf file in the apache installation directory direct the browser to the apache server documentRoot directory.
I am using windows 7 with the latest version of apache.
These are the virtual hosts defined
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerName dev.a.local
ServerAlias dev.a.local
DocumentRoot "D:/wwwroot/a/public"
ErrorLog "logs/a.log"
CustomLog "logs/a-access.log" common
<Directory "D:/wwwroot/a/public">
Options Indexes FollowSymLinks
AllowOverride All
# Controls who can get stuff from this server.
Order allow,deny
Allow from all
DirectoryIndex index.php
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName dev.b.local
ServerAlias dev.b.local
DocumentRoot "D:/wwwroot/b/public"
ErrorLog "logs/b.log"
CustomLog "logs/b-access.log" common
<Directory "D:/wwwroot/b/public"s>
Options Indexes FollowSymLinks
AllowOverride All
# Controls who can get stuff from this server.
Order allow,deny
Allow from all
DirectoryIndex index.php
</Directory>
</VirtualHost>
I have modified the hosts file and added
127.0.0.1 dev.a.local
127.0.0.1 dev.b.local
When i try to access dev.a.local or dev.b.local i am directed to the documentRoot of apache defined in httpd.conf.
Please help.
More posts by @Margaret670
2 Comments
Sorted by latest first Latest Oldest Best
Verify that the virtual hosts configuration file is not commented out in httpd.conf (as it is by default).
Example (Mac paths)
# Virtual hosts #Include /private/etc/apache2/extra/httpd-vhosts.conf
to
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
This may be all there is to it, but at the VERY beginning of that config file, put this line:
Listen 80
This tells Apache to actually listen for requests on port 80, and should help it work with the NameVirtualHost directive.
ALSO!!!
You have a typo on line 33:
<Directory "D:/wwwroot/b/public"s>
Should the problem persist, post your entire config file and I'll be happy to update my answer.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2025 All Rights reserved.