Php 不显示自定义错误403,而是显示默认错误

Php 不显示自定义错误403,而是显示默认错误,php,Php,我在htdocs/all/myproject/ error404.php error403.php index.php .htaccess 我还有一个名为“图像”的文件夹 在我的.htaccess文件中,我有以下代码 RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* error404.php [L] RewriteEngin

我在
htdocs/all/myproject/

  • error404.php
  • error403.php
  • index.php
  • .htaccess
  • 我还有一个名为“图像”的文件夹


    在我的.htaccess文件中,我有以下代码

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f  
    RewriteCond %{REQUEST_FILENAME} !-d  
    RewriteRule .* error404.php [L]  
    
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f  
    RewriteCond %{REQUEST_FILENAME} !-d  
    RewriteRule .* error403.php [L] 
    

    我打字的时候
    127.0.0.1/all/myprojects/nosuchfile.php
    inURL

    xampp显示了我定制的页面error404.php(这是预期的输出)


    但是当我打字的时候
    127.0.0.1/all/myprojects/images/
    它显示

    禁止进入! 您没有访问请求的目录的权限。没有索引文档或目录受读取保护

    我不想使用绝对路径,比如
    errordocument403/all/myprojects/error403.php


    xampp没有显示我定制的页面error403.php任何人都知道,我该如何实现它?ErrorDocument 404 file_for_404.php ErrorDocument 403 file_for_403.php在这种情况下,您只会在自定义403不是目录时触发它(
    RewriteCond%{REQUEST_FILENAME}!-d
    );我假设
    all/myprojects/images/
    是一个没有索引文件的目录,因此将恢复到标准的apache403 error.ErrorDocument 404 file_for_404.php ErrorDocument 403 file_for_403.php在这种情况下,您仅在自定义403不是目录时触发它(
    RewriteCond%{REQUEST_FILENAME}!-d
    );我假设
    all/myprojects/images/
    是一个没有索引文件的目录,因此将恢复到标准的apache403错误。