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