Fixed regex matching for redirecting