Memo about web path

Source: Internet
Author: User

When dealing with a lot of connections on web pages, it is often confused by some relative paths. Now, it is a reminder. In fact, it is very simple, but it is always hard to remember. Ah

We usually encounter the following three cases of relative paths. The following is an example.

1. path with the letter "/" as the header, the complete path will be the host name plus the path name
<A href = "/article/index.html"> Article </a> actually points to: http: // hostname/article/index.html
2. The complete path of the path starting with no slash will be the path above the current URL with this path name
<A href = "Article/index.html"> Article </a>: if the current webpage address is http: // hostname/book/list.html
Then, the connection will go to http: // hostname/book/article/index.html
3. One to n. the path starting with a slash. In fact, the whole path will be the path from the top level to N level of the current URL plus the path name. The second case is a special example of this situation.
<A href = "./article/index.html"> Article </a>. If the current page address is http: // hostname/book/list.html
Then, the connection will go to http: // hostname/book/article/index.html
<A href = "../article/index.html"> Article </a>. If the current page address is http: // hostname/book/list.html
Then, the connection will go to http: // hostname/article/index.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.