Boyundefeated
Boyundefeated

Reputation: 13

Semicolon in URLs

I have a URL like that: localhost:8080/demo/

And when I call localhost:8080/demo/''''''''' It working fine.

But when I try with localhost:8080/demo/;;; It not working and return HTTP code 404 Not Found.

I tried with few special character # % \ ? / , it returned 400 too.

Anyone can explain it for me? Thank you so much!

Upvotes: 1

Views: 10693

Answers (1)

Thomas Fritsch
Thomas Fritsch

Reputation: 10127

These special characters are not directly allowed in URLs, because they have special meanings there. For example: / is separator within the path, ? marks the query-part of an URL, # marks a page-internal link, etc.

Quoted from Wikipedia: Percent-encoding reserved characters:

When a character from the reserved set (a "reserved character") has special meaning (a "reserved purpose") in a certain context, and a URI scheme says that it is necessary to use that character for some other purpose, then the character must be percent-encoded. Percent-encoding a reserved character involves converting the character to its corresponding byte value in ASCII and then representing that value as a pair of hexadecimal digits. The digits, preceded by a percent sign (%) which is used as an escape character, are then used in the URI in place of the reserved character.

For example: ; is a reserved character. Therefore, when ; shall occur in an URL but without having its special meaning, then it needs to be replaced by %3B as defined here

Upvotes: 7

Related Questions