I'm trying to rewrite a place name from a url path into a query string on nginx.
I want ourdomain.com/hotels/london?some_key=value to become ourdomain.com?d=london&some_key=value
We were doing it with Apache -
RewriteRule ^hotels/([^/]+)/?\??(.*)$ ?d=$1&$2 [QSA]
And we're currently doing on haProxy (acting as a reverse proxy) -
reqrep ^([^\ :]*)\ /hotels/([^/\ \?]+)/?\??([^\ ]*)(.*)$ \1\ /?d=\2&\3\4
How do I do the same thing on nginx?