malhayek
4 years ago
2547
10
Laravel

Why do I always get a 404 error for any route I create?

Posted 4 years ago by malhayek

Hi, I apologize for being a rookie. This is my first time using frameworks and I chose Laravel.

installed the composer and created my first project as per the docs http://laravel.com/docs/5.1/installation

when I go to https://sub.example.com/dev/public. As I should, I get this message "Laravel 5"

However, I added the following route to my routes.php file

Route::get('authors', array('as' => 'authors', 'uses' => 'Authors_Controller@getIndex')  );

Then created a new controller called Authors_Controller. and here is my controller code

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

class Authors_Controller extends Controller
{
    //

    public function getIndex(){

        return view('authors.index')->withName('Mike A');

    }
}

finally I created a new veiw called "index" (i.e. index.blade.php file) inside a folder called "authors" to look like this and here is my view's code hello {{ $name }}

However, I keep getting 404 error when I got to https://sub.example.com/dev/public/authors

What I could be doing wrong?

Yes, the mod_rewrite is enabled.

Please sign in or create an account to participate in this conversation.