peg*_*leg 0 http-status-code-404 apache-2.2
我正在托管一个图像服务器,我的客户可以上传他们的照片供他们的客户稍后查看。我们已将我们的站点从 Windows 服务器迁移到 Linux。我们的一些客户习惯于在文件名中使用括号。这曾经在我们的 Windows 环境中工作,但在我们迁移到的 Apache/Linux 环境中不起作用,我们得到 404。当我们修改文件时,删除括号,我们能够提供服务。有没有办法允许Apache服务的文件名中的括号?
这是因为括号是RFC 3986保留的,不允许使用。如果您希望在 URL 中使用这些字符,则需要对这些字符进行百分比编码。
URIs include components and subcomponents that are delimited by
characters in the "reserved" set. These characters are called
"reserved" because they may (or may not) be defined as delimiters by
the generic syntax, by each scheme-specific syntax, or by the
implementation-specific syntax of a URI's dereferencing algorithm.
If data for a URI component would conflict with a reserved
character's purpose as a delimiter, then the conflicting data must be
percent-encoded before the URI is formed.
reserved = gen-delims / sub-delims
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
Run Code Online (Sandbox Code Playgroud)
如果你得到一个 404,那是因为它没有编码并且实际上没有查看正确的文件,因为括号被解释为分隔符。您想要做的是,假设您有一个 file some_image_(huzzah),您需要将其表示为some_image_%28huzzah%29URI。
| 归档时间: |
|
| 查看次数: |
478 次 |
| 最近记录: |