middleware that rewrites a request url by replacing the blog title with its id using a slug matching function