Currently I'm running webprojects with the following directory structure (simplified):
- project_folder/
- public/
- root/
- index.php
What I want to do is set the root in the server block to:
root /project_folder/root/;
But when a request location does not exists I want it to forward the request to project_folder/index.php. I tried the following:
try_files $uri ../index.php?$query_string;
But this doesn't seem to work.
The same goes for a request that starts with $document_root/public/* which need to be forwarded to: $document_root/../public/*
I did manage this by adding a index.php in the /project_folder/root/ folder which includes the /project_folder/index.php. For the public folder I created a symlink. I could probably solve this by adding an alias for the location /public/ however I'm trying to keep my config as generic as possible.
I'm trying to prevent setting the project_folder as a root folder as it sometimes contains files I prefer not to be accessed from the web. Introducing the 'root' folder is new but I'm trying to do this as efficient as possible. Existing webprojects do not have the root folder yet.
Is what I'm trying to do possible and how would I be able to achieve this.
Thanks in advance.