Relativize links to local hosts
Use globbing for https match
Rewrite HTTPS URLs for images as well
Why not just detect if the URL supports https?