Home >Common Problem >How to write the URL format http

How to write the URL format http

angryTom
angryTomOriginal
2019-07-30 11:55:25100666browse

How to write the URL format http

If you want to know more interesting knowledge about computers, you can click: FAQ

This article introduces the specifications of the HTTP protocol in depth. This article mainly introduces its URI, Request, Response, status code and other information. By understanding these specific contents, you can more intuitively understand the HTTP protocol format and working principle. .

URI structure

HTTP uses Uniform Resource Identifiers (URIs) to transmit data and establish connections. URL (Uniform Resource Locator) is a special type of URI that contains enough information for finding resources. We generally use URLs, and a complete URL contains the following parts:

//m.sbmmt.com:80/mix/76.html?name=kelvin&password=123456#first

1. Agreement part

The protocol part of the URL is http:, which means that the web page uses the HTTP protocol, and the following // is the delimiter

2. Domain name part

Domain name It is m.sbmmt.com. When sending a request, you need to resolve the IP to the DNS server. If you want to optimize the request, you can directly use IP as the domain name part

3. Port part

The 80 after the domain name represents the port, and is separated from the domain name by:. The port is not a required part of a URL. If the port is 80, you can also omit it and write

4. The virtual directory part

Starting from the first / of the domain name to the last / is the virtual directory part. Among them, the virtual directory is not a necessary part of the URL. The virtual directory in this example is /mix/

5. The file name part

From the last / of the domain name to ?, it is the file name part; if there is no ?, it starts from the last / of the domain name and ends with #, it is the file name part; if there is no ? and #, then it starts from the last / of the domain name From the beginning to the end, it is the file name part. The file name in this example is 76.html, and the file name is not a required part of a URL. If there is no file name, the default file name is used

6. Anchor part

From the beginning to the end of #, it is the anchor part. The anchor part of this part is first, and the anchor is not a necessary part of a URL

7. Parameter part

Starting from ? to ## The part between ## is the parameter part, also called the search part and the query part. The parameter in this example is name=kelvin&password=123456. If there are multiple parameters, use & as the separator between each parameter.

The above is the detailed content of How to write the URL format http. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn