Friday, December 5, 2014

Wamp and laravel installation, virtual host works but localhost not working

Problem:

I've been installing laravel framework on XAMPP/WAMP and made necessary changes on virtual host apache configurations so that I could pass local URL as http://laravel.dev, instead of http://localhost/laravel/public. It worked fine for this case. Then I typed on the browser http://laravel.dev/ the applications works correctly but when I try to work with other projects on localhost the browser show me the next message:


Not Found : The requested URL / was not found on this server.

Solution:


Before adding instruction in Apache virtual host we must add the instruction for localhost as well (i.e. not only for any other project). Because if we do not add localhost rule/instruction on virtual host  file (C:\xampp\apache\conf\extra\httpd-vhosts.conf) then the localhost, on the browser, will point to the DocumentRoot folder defined inside VirtualHost tag  *:80> that we created for another project.

Hence add the below rule/instruction on the virtual host file (in my case, C:\xampp\apache\conf\extra\httpd-vhosts.conf):
<VirtualHost *:80>
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    <Directory  "c:/wamp/www">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

1 comment:

  1. This blog is nice and very informative. I like this blog.
    blog Please keep it up.

    ReplyDelete