only redirecting when html was requested