Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel :: The requested resource /hello was not found on this server

I got error when I change .php file to .blade.php. Before I changed it got this error.

Route::get('hello','HelloController@index');

HelloController

public function index()
    {
      $data = array(
    'name'  => 'Rakesh',
    'email' => '[email protected]');
      return View::make('hello.index')->with('data', $data);
    }

/public/hello/index.blade.php

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Laravel 5.3 - Home page</title>
  </head>
  <body>
      <h1>Welcome Hello index </h1>
      <h1>{!!$data!!}</h1>
      <h1>{!!$data['email']!!}</h1>
  </body>
</html>

Error

The requested resource /hello was not found on this server.
like image 354
patipat chewprecha Avatar asked Dec 24 '16 14:12

patipat chewprecha


2 Answers

That error occurs when you create a folder in the public folder with the same name as your route so please change the name of the folder you have put in the public folder so that it has a different name from your route this will probably solve your error

like image 103
Matovu Ronald Avatar answered Nov 19 '22 15:11

Matovu Ronald


The view should be inside resources/views folder instead of public folder

like image 40
Saumini Navaratnam Avatar answered Nov 19 '22 15:11

Saumini Navaratnam