0

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?

1
  • Please show your full nginx configuration as shown by nginx -T. There is likely some other part that overrides this location block. 2 hours ago

0

You must log in to answer this question.

Browse other questions tagged .