Home  >  Article  >  Web Front-end  >  Introduction to the components of a URL

Introduction to the components of a URL

一个新手
一个新手Original
2017-09-25 10:37:242930browse

Take the following URL as an example to introduce the components of a normal URL

##http://www.aspxfans.com:8080/news /index.asp?boardID=5&ID=24618&page=1#nameAs can be seen from the above URL, a complete URL includes the following parts:

1.Protocol part: the URL The protocol part is "http:", which means that the web page uses the HTTP protocol. Various protocols can be used on the Internet, such as HTTP, FTP, etc. In this example, the HTTP protocol is used. The "//" after "HTTP" is the delimiter

2.Domain name part: The domain name part of the URL is "www.aspxfans.com". In a URL, you can also use the IP address as the domain name using

3.Port part: following the domain name is the port, and between the domain name and the port use " :" as delimiter. The port is not a required part of a URL. If the port part is omitted, the default port will be used

4.Virtual directory part: starting from the first "/" after the domain name "Start to the last "/", which is the virtual directory part. The virtual directory is also not a required part of a URL. The virtual directory in this example is "/news/"

5.The file name part: starting from the last "/" after the domain name to "?" is the file name part. If there is no "?", it starts from the last "/" after the domain name and ends with "#". It is the file part. If there is no "?" and "#", then it starts from the last "/" after the domain name. From the beginning to the end of the last "/", it is part of the file name. The file name in this example is "index.asp". The file name part is not a required part of a URL. If this part is omitted, the default file name is used

6.Anchor part: starting with "#" In the end, it’s all the anchor part. The anchor part in this case is "name". The anchor part is not a necessary part of a URL either

7.Parameter part: The part starting from "?" to "#" is the parameter part. Also known as the search part and query part. The parameter part in this example is "boardID=5&ID=24618&page=1". Parameters can allow multiple parameters, and "&" is used as a separator between parameters.

The above is the detailed content of Introduction to the components of a URL. 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