I would like that when you enter a page with the normal url (for example https://www.example.com/ ) the content that comes by default is displayed, but when adding a code (for example https://www.example.com /?example_code ) a notice appears at the top of the page that flags a notice. For example:
This is a notice because you have entered a non-existent page, and you have been automatically redirected to the main page (home).
I understand that this has no repercussions for SEO and that this url does not count as a separate page, but rather as a kind of command. I am using WordPress and my idea is that, to redirect people who enter non-existent pages (404 error) to the main page with a quote above that says a notice.
Thanks and regards.
You can add this script to the 404 page:
And then, on the home page, with php you can see if str exists and if it does add a