macaw icon indicating copy to clipboard operation
macaw copied to clipboard

Paths only work if site folder is root

Open ppazos opened this issue 6 years ago • 1 comments

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.

ppazos avatar Nov 02 '18 05:11 ppazos

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;
	}

}

wangkiyo avatar Aug 05 '20 10:08 wangkiyo