阿帕奇的ErrorDocument使用绝对路径 [英] Apache ErrorDocument with absolute path

查看:434
本文介绍了阿帕奇的ErrorDocument使用绝对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个虚拟主机的服务器。现在我想建立整个服务器的错误文档。我已经找到了我的错误的网站在/ var / WWW /错误/ *,但与ErrorDocument指令,我只能够设置相对误差文件文档根目录,但我想使用绝对路径(如在/ var / WWW /错误/ 404.html)。

I have a server with several virtual hosts. Now I want to set up the error documents for the whole server. I have located my error sites in /var/www/error/*, but with the ErrorDocument Directive I am only able to set the error document relative to document root, but I want to use the absolute path (e.g /var/www/error/404.html).

有没有人一个想法,我怎么能得到这个?

Has anyone an idea how I can get this?

推荐答案

我不认为这可以直接在语句中来完成:在的ErrorDocument 总会有相对于的DocumentRoot 。按照文档,唯一的选择似乎是指定一个外部URL,但因为错误的响应头被发送(302而不是404)是坏的。

I don't think this can be done directly inside the statement: The ErrorDocument will always have to be relative to the DocumentRoot. According to the docs, the only alternative seems to be specifying an external URL, but that is bad because the wrong response header gets sent (302 instead of 404).

您可以尝试任何事情是否可能使用别名指令或者 - 我敢肯定,这将工作 - 一个符号链接:

You could try whether anything is possible using an Alias directive or - I'm sure this would work - a symbolic link:

ErrorDocument 404 /symlinked_page.php

这篇关于阿帕奇的ErrorDocument使用绝对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆