Tell me if I understand you correctly.
- User follows the link example.com/John
- Since the link is invalid, we are redirecting to
example.com/?page=404
- But 404 should know about John
- So link
example.com/John
should redirect us toexample.com/?page=404&invalidQuery="John"
- For the 404 page you add logic to handle invalidQuery
Something like this?
You have three topics with similar questions
First, Second, this
Can you combine questions into one topic? Like this one.
Regards