Forum: NGINX url rewrite help - is this possible

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6f8f7b012ce674e3781244e591f747f3?d=identicon&s=25 rkmr.em@gmail.com (Guest)
on 2009-04-05 21:50
(Received via mailing list)
if i get a url like this
/123456/xxxx

will nginx be able to rewrite the url to:
/xxxx?id=123456

if so how can i do it?
thansk a lot!!
F5a6ed477b109fe6acc11a5a8f87e7e8?d=identicon&s=25 Michael Shadle (Guest)
on 2009-04-05 21:58
(Received via mailing list)
rewrite ^/(\d+)/(.+) /$2?id=$1 last;

more or less. although you'd probably want to make it /123456/xxxx/ -
without the delimiter the url can be anything really.
6f8f7b012ce674e3781244e591f747f3?d=identicon&s=25 rkmr.em@gmail.com (Guest)
on 2009-04-05 22:04
(Received via mailing list)
Hi Michael,
Thanks a lot for this. Yes you are right, i think i need this
/123456/xxxx/

in that case, is the following correct?

rewrite ^/(\d+)/(.+)/ /$2?id=$1 last;


can you explain what the word last means?
thanks a lot!
F5a6ed477b109fe6acc11a5a8f87e7e8?d=identicon&s=25 Michael Shadle (Guest)
on 2009-04-05 22:20
(Received via mailing list)
means it will not process any further rewrites
This topic is locked and can not be replied to.