Reputation: 21
The Lumen installation in my server is giving NotFoundHttpException when accessing without public/index.php.
Apache config:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/myapi/public
<Directory /var/www/html/myapi>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
.htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Directory structure:
> var/www/html
> ------------/myapi/ (lumen application)
> ------------/myapi/public/
index.php in var/www/html/myapi/public
$app->run($app->make('request'));
NotFoundHttpException:
Upvotes: 1
Views: 2935
Reputation: 59
The problem was solved by changing the
$app->run();
in /public/index.php
to
$request = Illuminate\Http\Request::capture();
$app->run($request);
Upvotes: 2
Reputation: 2972
NotFoundHttpException is given when your request is not listed in route.php
$app->get('request', function() {
return view('your view file');
});
Upvotes: 0