Igor L.
Igor L.

Reputation: 3445

Using Laravel/Lumen 5.2 with apache 2.4

Environment details:

The actions I took

I installed Lumen into the htdocs folder using:

composer create-project --prefer-dist laravel/lumen blog

so now the file path to index.php is:

c:\Apache24\htdocs\blog\public\

This is the content of my routes.php:

$app->get('/', function () use ($app) {
    return $app->version();
});

$app->get( 'foo', function() {
    return "Hello World!";
} );

First I was not able to even access http://localhost/blog/public so I changed the line $app->run(); in public/index.php code to $app->run($app->make('request'));

The problem:

Now I am unable to access http://localhost/blog/public/foo (with a response of 404)

EDIT

Based on Alexei's suggestion, I changed the config file and now http://localhost points to the '/' route, but I am still unable to access the http://localhost/foo

Thx for help ;)

Upvotes: 1

Views: 3973

Answers (2)

Igor L.
Igor L.

Reputation: 3445

In Apache - httpd.conf:

  • For the specified Directory change AllowOverride from None to All
  • uncomment the line LoadModule rewrite_module modules/mod_rewrite.so

Upvotes: 0

Alexey Mezenin
Alexey Mezenin

Reputation: 163758

Do not make any changes in Laravel files. You should point Apache to a public directory of Laravel project and restart it. After that use normal URLs like http://localhost.

Make these changes in Apache config:

DocumentRoot "c:\Apache24\htdocs\blog\public\"
<Directory "c:\Apache24\htdocs\blog\public\">

Upvotes: 2

Related Questions