Mobile app version of vmapp.org
Login or Join
Welton855

: 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

@Welton855

Posted in: #Apache #QueryString #Url #UrlEncoding

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 ??

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Welton855

1 Comments

Sorted by latest first Latest Oldest Best

 

@Lee4591628

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme