简体   繁体   English

带有自动前置+ ErrorDocument +选项的.htaccess文件出错

[英]Error in .htaccess File with Auto prepend + ErrorDocument + options

i have this .htaccess : 我有这个.htaccess

Options -Indexes
ErrorDocument 403 /server/403.php
php_value auto_prepend_file "./server/conferror.php"

but it send me this error: 但它发给我这个错误:

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 警告:未知:无法打开流:第0行的“未知”中没有此类文件或目录

Fatal error: Unknown: Failed opening required './server/conferror.php' (include_path='C:\\xampp\\php\\PEAR') in Unknown on line 0 致命错误:未知:在第0行的未知中打开所需的'./server/conferror.php'(include_path ='C:\\ xampp \\ php \\ PEAR')失败

if i Remove ErrorDocument Line it work good. 如果我删除ErrorDocument线它工作正常。 if i set ErrorDocument , and remove Options Line it Work Fine but not block Directory navigation... 如果我设置ErrorDocument ,并删除Options行它工作正常但不阻止目录导航...

this File is a handler for php error that need to be prepend via .htaccess php_value auto_prepend_file "./server/conferror.php" 这个文件是php错误的处理程序,需要通过.htaccess php_value auto_prepend_file "./server/conferror.php"预先php_value auto_prepend_file "./server/conferror.php"

How can i make work from .htaccess prevent navigation directory and ouput to file ErrorDocument at same time and Preserve the prepend file. 如何从.htaccess阻止导航目录和输出同时存档ErrorDocument并保留前置文件。

Soved with this code: 厌倦了这段代码:

# Control de Errores
php_value auto_prepend_file "server/conferror.php"
# Disable directory browsing 
Options -Indexes
# Hide the contents of directories
IndexIgnore *
# Hide files of type .png, .zip, .jpg, .gif and .doc from listing
IndexIgnore *.png *.zip *.jpg *.gif *.doc *.pdf *.txt *.jpeg *.log
# Allow access to php files
<Files *.log>
    deny from all
</Files>
<Files *.php>
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Files>
<Files index.php>
    Order Allow,Deny
    Allow from all
</Files>
<Files signal.php>
    Order Allow,Deny
    Allow from all
</Files>
# Mal Request
ErrorDocument 400 server/400.html
# No Autorizado
ErrorDocument 401 server/401.html
# Acceso Prohibido
ErrorDocument 403 server/403.html
# No Encontrada
ErrorDocument 404 server/404.html
# Error interno del Servidor
ErrorDocument 500 server/500.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM