URL Encode

URL(Uniform Resource Locator)

Web browsers request pages from web servers by using a URL. When you click on a link in an HTML page, an underlying <a> tag points to an address on the web. A Uniform Resource Locator (URL) is used to address a document (or other data) on the web.

Syntax rules

scheme://prefix.domain:port/path/filename

  • scheme - defines the type of Internet service (most common is http)(协议)
  • prefix - defines a domain prefix (default for http is www)(前缀)
  • domain - defines the Internet domain name (w3schools.com)(域名)
  • port - defines the port number at the host (default for http is 80)(端口)
  • path - defines a path at the server (If omitted: the root directory of the site)
  • filename - defines the name of a document or resource

Common URL Schemes

Scheme Short for Used for
http HyperText Transfer Protocol Common web pages. Not encrypted
https Secure HyperText Transfer Protocol Secure web pages. Encrypted
ftp File Transfer Protocol Downloading or uploading files
file A file on your computer

URL Encoding

URLs can only be sent over the Internet using the ASCII character-set. If a URL contains characters outside the ASCII set, the URL has to be converted.

URL encoding converts non-ASCII characters into a format that can be transmitted over the Internet. URL encoding replaces non-ASCII characters with a "%" followed by hexadecimal digits. (飞ASCII字符需要转化以十六进制数前加%标记)

URLs cannot contain spaces. URL encoding normally replaces a space with a plus (+) sign, or %20.(没有空格用+或%20代替)

Hello Günter被解析成text=Hello+G%C3%BCnter

For a complete reference of all URL encodings, visit our URL Encoding Reference.