1

I have laravel on localhost/laravel/public. I am trying set routes but this always generate 404 error on url localhost/laravel/public/user/John/[email protected]:

Route::get('user/{name}/{mail}', function($name, $mail)
{
    return "User $name : $mail";
});

and this work on url localhost/laravel/public/test/John/[email protected]

Route::get('test/(:any)/(:any)', function($name, $mail)
{
    return "Test $name : $mail";
});
1
  • Which version of laravel are you using? Commented Apr 28, 2014 at 8:21

1 Answer 1

2

If you are using L3 (third version of Laravel) then your second way to handle routes is correct.

Routing with parameters in {} like so:

Route::get('user/{name}/{mail}', function($name, $mail)

won't work as it was introduced in Laravel 4.

Read more about routing in L3 in here

Sign up to request clarification or add additional context in comments.

2 Comments

Read here about installing L4 - you can download it from github, BUT as from version 4 everything is handled by Composer. You can install composer and then install L4 from console - very handy :)
Don't be confused - whole laravel.com site is now dedicated to L4. The L3 docs are in link I gave you earlier

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.