fixed rewrite for https