BlackPearl
BlackPearl

Reputation: 2775

Laravel routes issue

I am trying to render a view when a user enter a particular address.

e.g

http://localhost/example/public/admin

what I have tried so far;

Route::any('admin', function()
{
return View::make('admin.login');
});

and

Route::any('/admin', function()
{
return View::make('admin.login');
});

the login.php in under a folder called admin in the view folder.

So far, none have worked.

my error:

Not Found. The requested URL /CoopBooks/public/admin was not found on this server.

Upvotes: 0

Views: 102

Answers (2)

BlackPearl
BlackPearl

Reputation: 2775

I was able to solve by doing the following.

I found out that rewrite_module in Apache was not automatically enabled for WampServer 2.4. I have enabled it and it is working fine.

Upvotes: 0

dev7
dev7

Reputation: 6369

First of all, you don't need 2 routes to the same address. Route::any('admin'..) and Route::any('/admin'..) are the same.

Per your problem, it seems as this is not a Laravel problem and the error is coming directly from your local server (if it was a laravel routing error, you would have received a different error syntax).

In other words, you are accessing the wrong URL. You can see that the error message refers to /CoopBooks/public/admin while it needs to refer to http://localhost/example/public/admin. That means that you are either typing in the wrong URL in the address bar, or you somehow changed the .htaccess or other Apache directives to direct the user to a different folder.

Make sure your URL is correct and everything should work...

Hope this helps!

Upvotes: 1

Related Questions