I am having the following testing environment structure:
/public/ -> public folder
/public/res/ -> resources folder (css, js)
/public/index.php -> index site (the only publicly used framework
file, everything else is outside public)
What i want to achieve is that every url except resources folder is pointed to index.php?foo=getvars keeping the current url structure in the address bar.
For example:
`/test2/something/something/` points to `/test2/index.php?foo=something/something/`
If possible, i want this redirect including .php files, so that it redirects like any other url instead of showing "no input file" error (hiding php file extensions).
What i tried so far is throwing a 500 internal error
location ~ ^/public/(?!res)(.*) {
try_files $uri $uri/ /test2/index.php?foo=$1;
}
#block direct php access - not working with redirect
#location ~ ^/public/.*\.php$ {
#return 404;
#}