Why does an anchor tag’s href values need http:// preprended to the URL?

There are several protocols: HTTP, HTTPS, FILE, SSH, SSL, FTP. In addition, as Jeremy mentioned, it’s quite possible you may have a file on your server with the exact name of the text you’re entering in the HREF.

Basically, any text in the href without a protocol is assumed to be a relative path if there is no / or protocol.

Leave a Comment