我正在尝试使用 2 个单独的 404 页面,具体取决于用户当前所在的目录。我认为您可以使用目录中的 .htaccess 文件执行此操作,但它不起作用。这甚至可能吗?
示例:用户正在查看 www.domain.com 中的文档。此目录应使用 number1_404.html。
示例 2:用户正在查看 www.domain.com/other_directory 中的文档。此目录应使用 number2_404.html。
我不完全确定如何为此编写规则,但这是我现在拥有的,但它不起作用。
.htaccess <--- in the root folder /httpdocs
ErrorDocument 404 /root_404.php
.htaccess <---- in the subdirectory /httpdocs/subdirectory
ErrorDocument 404 /subdirectory/subdirectory_404.php
也许我不明白这一切是如何运作的,所以请原谅我的无知。