I have a url.map
containing a rewrite rule
~^/A/shopby/(?<brand>[a-zA-Z]+) ~^/category/by-brand/$brand;
so that /A/shopby/a_brand
will be redirect to /category/by-brand/a_brand
And also a config file
map $request_uri $new_uri {
include /etc/nginx/urls.map;
}
server {
rewrite_log on;
error_log /var/log/nginx/error.log notice;
if ($new_uri) {
# return 200 $new_uri; for debugging
rewrite $request_uri $new_uri permanent;
}
location / {
root /a_root;
index index.html;
try_files $uri $uri/ /index.html;
}
}
And I keep getting this
*60 "$request_uri" does not match "/A/shopby/a_brand"
and also my debugging only returned me ~^/category/by-brand/$brand
which showed regex didn't replace the captured string
What did I miss in the process? Any help would be greatly appreciated