Handle query parameters correctly in redirector