How to create rewrites after migrating from wordpress to another blog

view full story

http://serverfault.com – I've migrated my blog from wordpress to Octopress, and from one domain to another. I want to create rewrites from old pages to new ones (old structure is http://domain.old/?p=number). I've created server block for this purpose which contains: server { listen 80; listen [::]:80; server_name .domain.old; rewrite .*p=1$ https://domain.new/2011/rebirth/ permanent; rewrite .*p=11$ https://domain.new/2011/travelling-salesman-problem/ permanent; rewrite .*p=14$ https://domain.new/2011/minecraft-classic-client-with-fly-ability/ permanent; # rewrite ^ https://domain.new per (HowTos)