Question

  1. i added in c:\Windows\System32\drivers\etc\hosts

    127.0.0.1 mysite.com

  2. in httpd-vhosts.conf

    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "c:/wamp/www/sf2/web/"
    ServerName mysite.com
    
  3. in httpd.conf uncommented "Include conf/extra/httpd-vhosts.conf"

mysite.com runs but now i have no acces to my older folders in c:\wamp\www is there a solution to have

"localhost/somefolder" ->opens "c:/wamp/www/somefolder"

"mysite.com" ->opens "c:/wamp/www/sf2/web/"

at the same time?

Was it helpful?

Solution

When you add virtual hosts you also have to create one for your localhost environment as well.

Also it is a good idea to create your vhosts outside the \wamp\www folder structure. I used C:\websrc\www in this example. It makes sure that the security for each site is not confused with another and if you change wamp you dont loose your site code by accident.

So try this in your httpd-vhosts.conf

Should be first vhost so the the wamp menu page loads
Also should keep the security as this PC and internal network only

<VirtualHost *:80>
    ServerAdmin webmaster@mysite.net
    DocumentRoot "C:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    <Directory  "C:/wamp/www">
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1 localhost ::1 192.168.0
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@mysite.net
    DocumentRoot "C:/websrc/www/sf2/web"
    ServerName mysite.com
    ServerAlias www.mysite.com
    Options Indexes FollowSymLinks
    <Directory "D:/websrc/www/sf2/web">
        AllowOverride All
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1 localhost ::1 192.168.0
    </Directory>
</VirtualHost>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top