macaw
macaw copied to clipboard
Paths only work if site folder is root
I have a host with a website on the root path and an app on a folder. Need routes to work on the folder (not root in the server), but that folder is the route of the app. The issue is having / as path doesn't work and route needs to be /myapp/ to be able to route to the app root.
I would suggest to add a config var base_folder or something like that and internally manage all routes relative to that path. With current behavior I need to prefix /myapp on every route, and if I move the app to a different folder, also need to rewrite all routes vs. changing one config var.
location /myapp {
root "pathto/myapp";
index index.php;
try_files $uri $uri/ /myapp/index.php?$query_string;
if (!-e $request_filename){
rewrite ^/myapp/(.*)$ /myapp/index.php?s=$1 last;
}
}