tomtomtom
tomtomtom

Reputation: 899

How change the base path use by the routing system in laravel

I'm new in Laravel and I start to set my routes. I use laravel 5.1 on a local wamp server.

I'm on local, http://localhost/ttt/ goes on /public directory of Laravel.

When I try this :

Route::get('admin',function(){
    echo 4;
});

and go to http://localhost/ttt/admin, I got an error but when I do this :

Route::get('ttt/admin',function(){
    echo 4;
});

It work. I check the config and changed the url value in config/app.php but it doesn't work.

Do you know if there is a kind of path used by the router that I can config?

Upvotes: 4

Views: 2349

Answers (1)

pespantelis
pespantelis

Reputation: 15382

You could prefix each route in the initial route group,

App\Providers\RouteServiceProvider@map:

$router->group(['prefix' => 'ttt', 'namespace' => $this->namespace], function ($router) {
    require app_path('Http/routes.php');
});

Upvotes: 2

Related Questions