Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 默认404错误页而不是自定义?_Php_Apache_Redirect_Http Status Code 404 - Fatal编程技术网

Php 默认404错误页而不是自定义?

Php 默认404错误页而不是自定义?,php,apache,redirect,http-status-code-404,Php,Apache,Redirect,Http Status Code 404,此页面返回默认404页面的原因:http://example.com/this%2Fthis 但是这个返回自定义的:http://example.com/this/this 这个函数还返回自定义函数:http://example.com/?i=this%2Fthis 这是我的htaccess文件: ErrorDocument 404 http://example.com/?id=error 在htaccess中,我明确指定了所有错误都应该重定向到的页面。在第一种情况下,我得到的是默认错误页,而

此页面返回默认404页面的原因:
http://example.com/this%2Fthis

但是这个返回自定义的:
http://example.com/this/this

这个函数还返回自定义函数:
http://example.com/?i=this%2Fthis

这是我的htaccess文件:

ErrorDocument 404 http://example.com/?id=error
在htaccess中,我明确指定了所有错误都应该重定向到的页面。在第一种情况下,我得到的是默认错误页,而不是自定义错误页


问题是,为了让url正常工作并重定向到自定义错误页面,我必须向htaccess文件中添加什么?

此行为是出于安全原因

由于安全原因,包含
%2f
%5c
字符的URL只需从
Apache
返回默认的
404


@阿努巴瓦:是的,上面这一行是我的完整.htaccess,这是因为
%2F
在查询字符串中,而不是在主URI中