我有一个带有 htaccess 的 404 个性化页面
ErrorDocument 404 /404.php
它工作正常,但它需要所有 .jpg、.js、.css 等...
我希望它只接受 .php 并对所有其他人执行正常的 404 错误。
我在任何地方都找不到该选项。
非常感谢。
最佳答案
不确定,但试一试:
<Files ~ "\.php$">
ErrorDocument 404 /404.php
</Files>
引自 Files Directive文档:
The <Files> directive limits the scope of the enclosed directives by filename.
关于php - 自定义 404 错误页面——仅适用于 PHP 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9631496/