0

I have the following in /var/www/html/blog/routes/web.php

Route::get('/', function () {
    return view('welcome');
});

Route::get('test', function () {
    return view('test', ['name' => 'Chris']);
});

If I go to http://52.214.14.137 then I see /var/www/html/blog/resources/views/welcome.blade.php.

If I go to If I go to http://52.214.14.137/test then I would expect to see /var/www/html/blog/resources/views/test.blade.php but instead I am seeing a 404.

What am I missing?

Chris
  • 4,672
  • 13
  • 52
  • 93
  • Is it a 404 error coming from Laravel itself (you can tell by the grey screen and stack trace)? Or is it a 404 error that's issued by Apache/NGINX? – maiorano84 Dec 23 '16 at 00:55
  • Looks like an Apache 404 error – Chris Dec 23 '16 at 00:56
  • just to be sure, could you mention laravel version, `APP_DEBUG` value in `.env` file, and your `.htaccess` file in public directory? – Bagus Tesa Dec 23 '16 at 00:56
  • If it's an Apache error, then that means your web server isn't routing the request properly to Laravel's `index.php`. Make sure your domain is set up to either honor `.htaccess` files and [make sure you have the appropriate configurations applied in your public folder](https://github.com/laravel/laravel/blob/master/public/.htaccess), or apply those rules directly in your virtualhost configuration. – maiorano84 Dec 23 '16 at 00:59
  • Hi. Laravel 5.3.28, APP_DEBUG is true and I've not touched the .htaccess file – Chris Dec 23 '16 at 00:59
  • To expand, you'll want to make sure [allowoverride](https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride) is set to 'all' (or something comparable) in the appropriate vhost configuration. – maiorano84 Dec 23 '16 at 01:01
  • Please add details about what OS you're using and if you use either xampp or wamp or lamp or mamp or anything else – Imam Assidiqqi Dec 23 '16 at 01:01
  • Perfect - I am using AWS EC2 and the default set up was to ignore .htaccess. I followed the instructions on http://stackoverflow.com/questions/19408349/htaccess-works-in-localhost-but-doesnt-work-in-ec2-instance and voila, sorted. Thank you – Chris Dec 23 '16 at 01:02

1 Answers1

0

I was using Amazon EC2 and the .htaccess file was being ignored by default.

I had to change /etc/httpd/conf/httpd.conf so

AllowOverride None

Become

AllowOverride All

I then restarted Apache with the command below and then Laravel worked perfectly.

sudo service httpd restart 
Chris
  • 4,672
  • 13
  • 52
  • 93