php - Apache VirtualHost Issues -


i have 2 installations of laravel. 1 in folder called "laravel" , second in folder called "learninglaravel". both of them siblings in same parent folder. before installed "learninglaravel" used access site in "laravel" through localhost/laravel/public, , works fine .

after installed "learninglaravel", decided create virtual host on wamp server name "learninglaravel.dev" . [windows/system32/drivers/etc/hosts] file looks this:

127.0.0.1       localhost 127.0.0.1       localhost // added entry. first 2 entries above there 127.0.0.1       learninglaravel.dev 

i added following apache "httpd-vhosts.conf"::

<virtualhost *:80>     documentroot "c:/wamp/www/learninglaravel/public"     servername learninglaravel.dev </virtualhost> 

now can access "learninglaravel" through learninglaravel.dev. when want access site in "laravel" folder through localhost/laravel/public, message ::

not found requested url /laravel/public not found on server. 

i try localhost , ::

not found requested url / not found on server. 

the problem have begins localhost doesn't work, learninglaravel.dev works.

what changes need make? thanks.

just define 2 virtual hosts:

  • the first catches domains don't have own virtual host. in example these domain1.dev, domain2.dev, domain3.dev , localhost.
  • the second host catches domain learninglaravel.dev

httpd-vhosts.conf

<virtualhost *:80>     documentroot "c:/wamp/www/"     servername localhost     serveralias *.localhost </virtualhost>  <virtualhost learninglaravel.dev:80>     documentroot "c:/wamp/www/learninglaravel/public"     servername learninglaravel.dev     serveralias *.learninglaravel.dev </virtualhost> 

windows/system32/drivers/etc/hosts

127.0.0.1       learninglaravel.dev # don't need following explanation: 127.0.0.1       domain1.dev 127.0.0.1       domain2.dev 127.0.0.1       domain3.dev 

Comments