0

I just set up my composer and install a new laravel 5.4 project, and i set up a virtual host for apache server .

The virtual Host configuration

Te virtual host configuration

And the host file :

enter image description here

The home page laravel.app of the new application working fine
But when i add a new view and i set a route for it like example :

//This is The default Home page route
Route::get('/', function () {
    return view('welcome');
});
// This is the new Route
Route::get('/hello',function(){
    return view('hello'); // I created another view with the name hello.blade.php  

});


When i try to access to it using the link laravel.app/hello i get this error :

Not Found

The requested URL /hello was not found on this server. Apache/2.4.18 (Ubuntu) Server at laravel.app Port 80

I want to mention that my os is Ubuntu 16.04

Zakaria Guenna
  • 129
  • 1
  • 12

1 Answers1

0

First of all check if mod_rewrite is enabled or not. Use this question's answer.

Second Place a .htaccess file in .../public with the following contents:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Checkout that reference

Community
  • 1
  • 1
SaidbakR
  • 13,303
  • 20
  • 101
  • 195
  • about your [question's answer](http://stackoverflow.com/a/10891317/1592845) i didn't find the line `#LoadModule rewrite_module modules/mod_rewrite.so` in `apache2.conf` file – Zakaria Guenna Apr 06 '17 at 23:36
  • i activated `mod_rewrite` using `sudo a2enmod rewrite` now everything you said it's done but it's still the same problem. – Zakaria Guenna Apr 06 '17 at 23:50
  • The regarded answer of the question, is talking, mainly, about checking the existence of the mod_rewrite from `phpinfo()` output. However, did you restart Apache? – SaidbakR Apr 07 '17 at 00:13
  • 1
    `mod_rewrite` exist in the `phpinfo() Loaded Modules ` . – Zakaria Guenna Apr 07 '17 at 00:15
  • What about the `.htaccess`? – SaidbakR Apr 07 '17 at 00:17
  • If your `.htaccess` is placed in the correct path and it has the correct code regarded in the answer. So there is only one probability. Your view file `hello.blade.php` **is not** created in the `views` folder next to `welcome.blade.php` – SaidbakR Apr 07 '17 at 00:24