本文介绍了自定义 404 错误页面——仅适用于 PHP 页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有 htaccess 的 404 个性化页面

I have a personalized page for 404 with htaccess

ErrorDocument 404 /404.php

它工作正常,但它需要所有 .jpg、.js、.css 等...
我希望它只使用 .php 并为所有其他人执行正常的 404 错误.

It works fine, but it takes everything .jpg, .js, .css etc...
I would like it to just take the .php and do a normal 404 error for all others.

我在任何地方都没有找到该选项.

I didn't find that option anywhere.

非常感谢.

推荐答案

不确定,但试试这个:

<Files ~ "\.php$">
    ErrorDocument 404 /404.php
</Files>

引用自 文件指令 文档:

指令限制了所包含的范围按文件名的指令.

这篇关于自定义 404 错误页面——仅适用于 PHP 页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-05 09:10