Nginx rewrite rules allows one to specify how URLs have to be redirected.

This is useful when you make changes to your web content which break URLs external sites might still reference, like, for instance, when you move or delete some posts.

Consider, for instance, the following rewrite directive:

server {


      rewrite  "/adolfo/spm[0-9]{2}.*$";

Here, the rewrite rule redirects URLs in the form[0-9][0-9]/... to

This is the rule I use to redirect students trying to access old editions of my Software Project Management course (which used to be published in my home, under spm<YEAR>) to the new dedicated website which hosts all the content related to the course.