Added logic to not duplicate rewrite location on http and https locations