Forum Moderators: phranque
h**p://www.mysite.com/index.php?Id=xyz
When the content with Id=xyz does not exist the index page itself is shown with a directory of possible Ids.
What response code should I return when a visitor clicks that link?
I was thinking of returning a 404, but instead of showing my custom error page I want to redirect them to the base index page:
header("HTTP/1.0 404 Not Found");
header("Location: h**p://www.mysite.com/index.php");
Thanks,
Arjan
You should consider putting up a temporary page, so that you have something meaningful to 302-redirect to. Do not 302 to your home page or site map; that will confuse the 'bots and you may end up with the temporary URL replacing your home page URL in the search results. Do this by the book [w3.org], and stay out of trouble. :)
Jim
I already looked at that page, but I couldn't find an appropriate response for my situation. So I decided to use a 404 and redirected to my index page as I don't want visitors to end up at my 404 error page from a link in my own site. But (I assume) PHP doesn't send a 404 together with a Location header, it automagically is changed into a 302 Found response which indeed is not the correct response in my situation.
Well I'll see what I will do,
Arjan