nginx 301 redirect after changing structure of url

admin

Administrator
Staff member
I have this blog (wordpress...) and i changed its permalinks in the follwoing way:

OLD :
Code:
http://www.example.com/2015/05/04/my-post
<br>
NEW:
Code:
http://www.example.com/my-post

so i simply removed the date from the link. the problem is i have many posts (thousands) published all over the net with the old structure.
there are qordpress plugins that allows you to create 301 redirect for a specific request but is there a way in the server level where i can do this 301 redirect without dealing with plugins etc..
the structure is consistent so even though i never worked with regex i guess it can help me here?? any other solutions will be highly appreciated ..thx