Redirect urls

I’m porting a .asp application over to something else, and I need to
re-write the following url pattern:

www.example.com/posts/get_post.asp?post_id=123

to

www.example.com/posts/123

How can I do that?

On Mon, Oct 15, 2012 at 10:56 AM, S Ahmed [email protected] wrote:

I’m porting a .asp application over to something else, and I need to
re-write the following url pattern:

www.example.com/posts/get_post.asp?post_id=123

to

www.example.com/posts/123

location = /posts/get_post.asp {
return 301 /posts/$arg_post_id;
}

So when nginx responds with a 301, is that an additional rountrip for
the
user?

Could I somehow maintain the url for the client, but internally re-write
it
to the updated url so my web application can handle it correctly?

On Mon, Oct 15, 2012 at 9:26 PM, S Ahmed [email protected] wrote:

So when nginx responds with a 301, is that an additional rountrip for the
user?

Could I somehow maintain the url for the client, but internally re-write it
to the updated url so my web application can handle it correctly?

rewrite ^ /posts/$arg_post_id;

so like this:

location = /posts/get_post.asp {
rewrite ^ /posts/$arg_post_id;
}

correct?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs