Skip to main content

Nginx Map doesn't interpolate variables [Resolved]

I am trying to join a variable and a string within the map directive in Nginx, but no luck so far. The idea is that any requests to /press/some-variable-text should get redirected to /magazine/some-variable-text

map $uri $new_uri {
    ~^/press/(?.+)$ /magazine/$press_id;
}

The output of this is be the following string "/magazine/$press_id" (it doesn't interpolate the variable). When I remove the prefix /magazine/ then the variable content is rendered normally.

Is there a way to achieve this?


Question Credit: Ander
Question Reference
Asked April 14, 2019
Tags: nginx
Posted Under: Network
71 views
1 Answers

Your Answer
D:\Adnan\Candoerz\CandoProject\vQA