I am trying to emulate an API path to reroute to a PHP script. I'm trying the following configuration (found here), but receiving a 404
.
location ~ ^/api/v1/(.*)/?$ {
try_files $uri $uri/ /v1/index.php?req=$1&$args;
}
I am expecting any request that comes in through .com/api/v1/user/alert/123
to be received by the script in /v1/index.php
and can be captured as a $_SERVER['REQUEST_URI']
path (e.g. /user/alert/123
).
Any suggestions?
nginx -T
. There is likely some other part that overrides thislocation
block.