Nginx rewrite: replace - with /

Solution 1:

And the answer is:

server {
# <...>

rewrite ^/stuff-(.*) /stuff/$1 permanent;
rewrite ^/stuff/(.*) /stuff-$1;

location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header HOST $http_host;
    proxy_set_header X-NginX-Proxy true;

    proxy_pass http://127.0.0.1:2368;
    proxy_redirect off;
}
}