1

目前,我的 .htaccess (位于 www/site 目录中)中有一些 ErrorDocuments,例如 ErrorDocument 404 /site/error,它们可以工作。

但是,此站点目录中有一个目录不应包含这些自定义错误文档。因此,每当用户尝试访问 /site/no_custom_errors/non_existing_file.png 时,我应该得到默认的 Apache 错误页面,而不是我的自定义错误。

我将如何实现这一目标?

4

1 回答 1

0

Your apache config for that directory can change it, or if "AllowOverride FileInfo" (see: http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride) is active for that site or directory, then an .htaccess file in that directory will work containing:

ErrorDocument 404 /site/otherErrorDoc

see: http://httpd.apache.org/docs/current/mod/core.html#errordocument

Alternatively, it could be done in a <directory> directive in httpd.conf or in a virtual host like so:

<Directory path/to/special/directory>
    ErrorDocument 404 /site/otherErrorDoc
</Directory>

see: http://httpd.apache.org/docs/2.2/mod/core.html#directory

于 2013-05-07T21:38:16.033 回答