Middleware to route by url