ryank
ryank

Reputation: 395

Laravel routing not working correctly

Quick question,

EDIT: I do not know how to access other routes besides '/' Here are the routes I want to access

Route::get('/', 'HomeController@index');

Route::get('users', 'UserController@index');

Route::get('foo', function()
{
    return 'Hello World';
});

Here is my routes. Via php artisan routes enter image description here

I can successfully access localhost/cartraderlaravel/public It takes me to HomeController@index

when I try to access foo or users I get enter image description here

I have tried

localhost/cartraderlaravel/public/users localhost/cartraderlaravel/users localhost/cartraderlaravel/foo localhost/cartraderlaravel/public/foo

All of these return a "Not Found" error. Help anyone?

Upvotes: 0

Views: 304

Answers (2)

Khan Shahrukh
Khan Shahrukh

Reputation: 6351

You should point your root directory to cartraderlaravel/public in WAMP so that you need not to visit localhost/cartraderlaravel/public. To do that in WAMP follow :

  1. Click on WampServer icon in taskbar
  2. Select Apache > httpd.conf from the pullup
  3. Search for the term “DocumentRoot”
  4. Change the DocumentRoot path to your custom directory
  5. Search again for “DocumentRoot” again same procedure
  6. Save your changes and “Restart All Services”

Upvotes: 1

ryank
ryank

Reputation: 395

Further research shows this is a common problem with WAMP. Something to do with Apache settings. I have moved to using a virtual network and everything works now

Upvotes: 0

Related Questions