: How should incorrectly encoded URLs be handled? Just recently noticed that some sites link with the URL incorrectly percent-encoded, to which my server (LAMP) responds with a 404 Not Found. For
Just recently noticed that some sites link with the URL incorrectly percent-encoded, to which my server (LAMP) responds with a 404 Not Found.
For example, for a URL of mine like this:
www.site.com/page.php?param=value
They link to it like this:
www.site.com/page.php%3Fparam%3Dvalue
So:
Who is wrong? My server for not understanding? or the linking site for not specifying the URL properly?
Could something be done to configure Apache to understand the misencoded query string delimiter (%3F instead of ?)?
If not, would it be safe to setup redirects by translating the %3F to ??
More posts by @Welton855
1 Comments
Sorted by latest first Latest Oldest Best
First things first, as @LazyOne said, the third-party URLs are not being properly generated, so the expectation is server to fail - as it is failing right now as you described.
Note that valid HTML and valid URLs are a different thing. You should escape entities for HTML content, but this is not true when writing links, image addresses, and calls for external files.
Before deciding to escape or not, ask yourself: is this going to be read by a user or by a browser? The answer will tell you which type of encoding you should use.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.