1
votes

I am beginner in Laravel. I used Laravel 5.1 in Wamp Server (Apache/2.4.9 (Win64) PHP/5.5.12)

I received the 404 Not Found Error, when I called the page like

http://localhost/laravel/public/login

enter image description here

Route::get('login', function() {
//return View::make('login');
return 'Hello World';  });

vhost.conf code

ServerAdmin [email protected]
DocumentRoot "C:\wamp\www\laravel\public"
ServerName localhost
ErrorLog "logs/AuthorityController.www-error.log"
CustomLog "logs/AuthorityController.www-access.log" common


   <Directory "C:\wamp\www\laravel\public">

    Options Indexes FollowSymLinks MultiViews
     AllowOverride All
     Order allow,deny
     allow from all
</Directory>
2
do u get any out put above ur code ?Hamelraj

2 Answers

0
votes

Try this: http://localhost/login may be it helps you, i hope :). And check that you vhost in appache is set to .../your_laravel_project/public folder

UPDATE Go to C:\Windows\System32\drivers\etc\hosts and add line at the bottom:

127.0.0.1 myproject.dev

Then, in your appache httpd.conf file you shoud uncoment line:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf 

BONUS: You can also switch directory with you projects in lines (for instance i have my projects in 'F:/Code'):

DocumentRoot "F:/Code"
<Directory "F:/Code">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>

Next step, in your httpd-vhosts.conf you should have:

<VirtualHost myproject.dev> 
    DocumentRoot "F:\Code\myproject\public"
    ServerName myproject.dev
    ServerAlias myproject.dev
    <Directory "F:\Code\myproject\public">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
   </Directory>
</VirtualHost>

Then reset appache. And when you go to your browser and put http://myproject.dev you should see your page :)

0
votes

You don't need to do that anymore. Don't include that. What you do is put a view file (your 404 error view) called 404.blade.php in your resources/views/errors folder and Laravel will handle 404 errors for you.