Search code examples
urlencodingquery-string

Does a `+` in a URL scheme/host/path represent a space?


I am aware that a + in the query string of a URL represents a space. Is this also the case outside of the query string region? That is to say, does the following URL:

http://a.com/a+b/c

actually represent:

http://a.com/a b/c

(and thus need to be encoded if it should actually be a +), or does it in fact actually represent a+b/c?


Solution

    • Percent encoding in the path section of a URL is expected to be decoded, but
    • any + characters in the path component is expected to be treated literally.

    To be explicit: + is only a special character in the query component.

    https://www.rfc-editor.org/rfc/rfc3986