如何使用ErrorDocument来重定向到PHP文件在同一文件夹?如何使用、文件夹、重定向、文件

2023-09-02 00:51:52 作者:粗暴女友

我想在一个特定的文件夹中的文件丢失请求并将其重定向到 program.php 的文件夹中。

I want to take requests for missing files in a specific folder and redirect them to program.php in that folder.

这是一个程序,我会用很多不同的地方,我会preFER避免指定在htaccess的文件的文件夹的名称。

This is a program I will use a lot in different places, and I would prefer to avoid specifying the name of the folder in the htaccess file.

我曾尝试只是把:

errordocument 404 program.php

但结果是,浏览器只是打印出program.php并不会执行program.php。

but the result is that the browser just prints out "program.php" and doesn't execute program.php.

我理解的为什么这是发生:基于文件的http://httpd.apache.org/docs/2.0/mod/core.html,网址不以一个斜线或http都PTED文本消息跨$ P $。

I understand why this is happening: based on the documentation at https://m.xsw88.com/allimgs/daicuo/20230902/303.png.jpg$ program.php?i=$1.jpg [L]

第二行验证该文件不存在,从而使现有的图像将正确地被显示。

The second line verifies that the file does not exist, so that existing images will be shown correctly.