Can a URL have an asterisk?

后端 未结 3 1763
自闭症患者
自闭症患者 2020-12-05 18:13

I notice Wikipedia allows them in their URLs, is it legit or does anyone know where it will give me problems?

3条回答
  •  再見小時候
    2020-12-05 19:03

    Yes. All of the sub-delims characters can be used as is in the path. Sub-delimiters include the asterisk (*) character:

    sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
                  / "*" / "+" / "," / ";" / "="
    

    There are several types of URIs, but in general, a path is defined as a set of segments separated by a slash:

    path-absolute = "/" [ segment-nz *( "/" segment ) ]
    

    The segments are composed of characters (segment-nz cannot be empty):

    segment       = *pchar
    segment-nz    = 1*pchar
    

    And pchar includes sub-delims:

    pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
    

    Reference: https://tools.ietf.org/html/rfc3986#appendix-A

提交回复
热议问题