1

I am running a server locally. It's Apache2 with PHP. Following are the files that I have written.

.htaccess

ErrorDocument 404 /notFoundError.php

/notFoundError.php

<?php
  echo phpinfo();
?>

When I type some non-existing url http://localhost/this/is/dummy?key=value, it successfully redirects to notFoundError.php and prints the phpinfo table. There I do not find key=value in the _SERVER["QUERY_STRING"] row.

hakre
  • 193,403
  • 52
  • 435
  • 836
Goje87
  • 2,839
  • 7
  • 28
  • 48
  • Try to `var_dump($_SERVER)`, maybe it's in there somewhere. – gen_Eric Jul 23 '12 at 18:29
  • possible duplicate of [how to Pass query string in 404 error redirect through .haccess?](http://stackoverflow.com/questions/10366139/how-to-pass-query-string-in-404-error-redirect-through-haccess) – hakre Jul 24 '12 at 01:58

2 Answers2

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']

Community
  • 1
  • 1
barancw
  • 888
  • 9
  • 18
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?

mlishn
  • 1,689
  • 14
  • 19