escGoat007
escGoat007

Reputation: 43

Unable to find a route in Laravel with Apache

Every route I currently try in Laravel 4 is throwing a 404 error.

I only have two pages; the homepage, and a login page.

Now my issue is that I cant navigate to the /login route.

But when I change my login route to the default route which is 172.16.55.136/laravel/public/, then it works.

So the login route is 172.16.55.136/laravel/public/login which then gives me as 404.

This is the route file:

Route::get('/', array('as' => 'home' ,'uses' => 'HomeController@getIndex'));

Route::get('/login', array('as' => 'login', 'uses' => 'AuthController@getLogin'));
Route::post('login', array('uses' => 'AuthController@postLogin'));

I also changed my apache2 config file to the following:

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

Is there something else that I can do to fix this?

Upvotes: 0

Views: 145

Answers (1)

Amelia
Amelia

Reputation: 2970

Your index directory should be the public folder in Laravel, as that is where the entrypoint exists (public/index.php)

Change your config to the following:

<Directory /var/www/laravel/public>
  Options Indexes FollowSymLinks
  AllowOverride All
  Require all granted
</Directory>

Then just access your laravel app at http(s)://hostname

Upvotes: 1

Related Questions