I have three folders with static files (Angular apps): web, login, admin.
I want to serve:
web
folder when the URL is/*
login
when the URL is/admin/*
and not loggedadmin
when the URL is/admin/*
and logged.
My routes.php
:
// admin folder Route::get('/admin', ['before' => 'auth', function() { return File::get(public_path() . '/admin/index.html'); }]); Route::get('/admin/{slug}', ['before' => 'auth', function($slug) { return File::get(public_path() . '/admin/' . $slug); }]); //login folder Route::get('/admin', function() { return File::get(public_path() . '/login/index.html'); }); Route::get('/admin/{slug}', function($slug) { return File::get(public_path() . '/login/' . $slug); }); // web folder Route::get('/', function() { return File::get(public_path() . '/web/index.html'); }); Route::get('/{slug}', function($slug) { return File::get(public_path() . '/web/' . $slug); });
Problems:
/{slug}
doesn't serve files from subfolders.- When I am not logged,
/admin/
redirect me to/login
. - Must have a way to write this routes with regular expressions.
How can I solve the previous points?