I just solved this problem by replacing %
with percent
, because this was only the case in one of my URLs. For a better solution see this link Sam Rad provided my the first comment on my post:
Apache: %25 in url (400 Bad Request)
Why does this URL cause a bad request on my server?
-
29-03-2022 - |
题
I have a URL which ends with a %
. Like: /view/this-is-100%25
. Is it not allowed to have %
at the end of a URL? If it's not allowed how can I do it in another way and if it's allowed, why does it cause a bad request?
Thanks.
update: exact error:
Bad Request
Your browser sent a request that this server could not understand.
解决方案 2
其他提示
"%" is used in URLs as a prefix for an ASCII (?) UTF-8(?) code. For example a "space" (ASCII 32 or hex 0x20) can be substituted as "%20". The "%" prefix is followed by two hex digits. The web server should take the "%20" and convert it to a space.
When you have a "%" at the end of a URL, you do not have two hex digits following the "%", so the substitution cannot be done, and the URL is in-fact malformed. It is actually a bad URL.
This is why the server doesn't like it.
不隶属于 StackOverflow