I have a nginx map of a bunch of uri’s that I want to redirect to another uri. The problem is some of them uri’s has uri encoded chars like %20 or %29. Now what’s going on is that nginx gives me the request uri but its uri decoded meaning for example its giving me “/blogpost/november twentysixth” instead of “/blogpost/november%20twentysixth” which is needed to match the uri in the map.
I have a total of 53k uri’s to redirect so don’t say we should just do location … with every single uri.
I appreciate any response and help, this is pretty urgent so please reply fast.
I tried to rewrite the url to filter out the whitespace etc but that caused problems because I then had duplicated uris. (Causing nginx to not start anymore and returning an error)
I tried to implement Lua but probably not the right way or it just didn’t work.
Vin Hegewald is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.