urluricustom-protocolcustom-url

Rules for using # sign in a custom URL


In an HTTP URL, the hash sign (#) signifies an anchor within a page and may only appear once.

Is this a universal rule for all URLs? If I want to implement a custom URL protocol, can I use the following as a legal URL?

myprotocol://zoo#1/cage#30/lion#11


Solution

  • In your own protocol you may do what ever you please. However if you want common parsers to be able to parse your URL you'll have to follow RFC3986 You may want to take a look at section 3 syntaxe component as for rules for using "#", "?", ":" and "/".