Running php-app in a subdirectory causes problems

It’s hard for any application to be served from a subpath, really. Here’s an post that explains:

In this case, the fact that Caddy is modular makes this difficult to resolve. If one module makes a decision (like a rewrite, or uri strip_prefix as handle_path implicitly performs) means that modules need to inspect the request state to try to figure out what to do.

The REQUEST_URI variable by definition is supposed to be “the original request URI”, so we send that as-is, no modifications.

You can override REQUEST_URI yourself with the env option, but I’m not sure that will always have the right effect. You could try though.

1 Like