I have the following issue,
I need to configure Nginx, so on any URL user accesses, it will keep the uri (example domain.com/some/url/
), but pass to laravel only /
and let Angular handle the routing.
Route::get('/', function(){
return view('index');
});
And when accessing /api/{anything}
Laravel will kick in.
For now I return index.html
from public folder until I find solution
Here is My Config:
location / {
index index.html;
try_files $uri $uri/ /index.html;
}
location /api {
index index.php;
try_files $uri $uri/ /index.php?$query_string;
}
I know I can make a route like:
Route::get('{anything?}', function(){
return view('index');
});
But is to broad.
Update:
location / {
rewrite ^/(.*)$ / break;
index index.php;
try_files $uri $uri/ /index.php;
}
location /api {
index index.php;
try_files $uri $uri/ /index.php?$query_string;
}