带有自动前缀 + ErrorDocument + 选项的 .htaccess 文件出错
Error in .htaccess File with Auto prepend + ErrorDocument + options
我有这个 .htaccess
:
Options -Indexes
ErrorDocument 403 /server/403.php
php_value auto_prepend_file "./server/conferror.php"
但它向我发送了这个错误:
Warning: Unknown: failed to open stream: No such file or directory in
Unknown on line 0
Fatal error: Unknown: Failed opening required './server/conferror.php'
(include_path='C:\xampp\php\PEAR') in Unknown on line 0
如果我删除 ErrorDocument
行,效果很好。
如果我设置 ErrorDocument
,并删除 Options
Line 它工作正常但不阻止目录导航...
此文件是 php 错误的处理程序,需要通过 .htaccess
php_value auto_prepend_file "./server/conferror.php"
我如何从 .htaccess
开始工作以防止同时将导航目录和输出到文件 ErrorDocument
并保留前置文件。
喜欢这个代码:
# 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
我有这个 .htaccess
:
Options -Indexes
ErrorDocument 403 /server/403.php
php_value auto_prepend_file "./server/conferror.php"
但它向我发送了这个错误:
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required './server/conferror.php' (include_path='C:\xampp\php\PEAR') in Unknown on line 0
如果我删除 ErrorDocument
行,效果很好。
如果我设置 ErrorDocument
,并删除 Options
Line 它工作正常但不阻止目录导航...
此文件是 php 错误的处理程序,需要通过 .htaccess
php_value auto_prepend_file "./server/conferror.php"
我如何从 .htaccess
开始工作以防止同时将导航目录和输出到文件 ErrorDocument
并保留前置文件。
喜欢这个代码:
# 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