D
D
DTX2016-08-31 00:55:04
Laravel
DTX, 2016-08-31 00:55:04

Is it possible to make relative paths in Laravel?

There is a site. Laravel is located in the / sub folder. Those. index.php is in /sub/public.
For routes to work, you need to write

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

Is it possible to make it so that it is not necessary to write the path in its entirety, but only
$app->get('/', function () use ($app) {
    return $app->version();
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
D', 2016-08-31
@DirecTwiX

$router->group(['prefix' => 'sub'], function ($router) {
  $router->get('public', function ($router) {
      return $router->version();
  });
});

A
Andrey Privalov, 2016-08-31
@negasus

The Route::get('/') route just points to the public folder of the Laravel project.
That is, in nginx (or whatever you have) you specify the site root as .../sub/public and everything works.
Or did I misunderstand the question?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question