1

Environment details:

  • Windows 10
  • PHP7
  • Apache 2.4.

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 ;)

Igor L.
  • 3,159
  • 7
  • 40
  • 61

2 Answers2

2

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\">
Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279
  • Hi, thx for the suggestion, I changed the config file an now http://localhost points to the '/' route, but I am still unable to access the http://localhost/foo – Igor L. May 24 '16 at 15:55
  • I award a +1 for the suggestion :) – Igor L. May 24 '16 at 15:56
0

In Apache - httpd.conf:

  • For the specified Directory change AllowOverride from None to All
  • uncomment the line LoadModule rewrite_module modules/mod_rewrite.so
Igor L.
  • 3,159
  • 7
  • 40
  • 61