Middleware to change the base url