adding middleware for 301 redirect