Use RegExp to search for hostname instead of indexOf

- indexOf does not account for URLs that may contain http (e.g.
   www.example.com/http)