1

我在本地运行服务器。它是带有 PHP 的 Apache2。以下是我编写的文件。

.htaccess

错误文档 404 /notFoundError.php

/notFoundError.php

<?php
  回声 phpinfo();
?>

当我键入一些不存在的 urlhttp://localhost/this/is/dummy?key=value时,它会成功重定向到notFoundError.php并打印 phpinfo 表。我没有在行key=value中找到。_SERVER["QUERY_STRING"]

4

2 回答 2

4

Check out how to Pass query string in 404 error redirect through .htaccess? for your answer.

You will need to access $_SERVER['REDIRECT_QUERY_STRING']

于 2012-07-23T18:25:18.560 回答
0

If you are sending to a page which does not exist, a 404 will be invoked. Which is why you are being redirect to notFoundError.php and then displaying its contents?

What are you trying to accomplish?

于 2012-07-23T18:25:10.330 回答