开发者

Routing redirection decision

I have really no idea why I'm asking this as this a really completely irrelevant question for which I should have figured out an answer within milliseconds, yet I'm doing it.

So in my project I have a Router class which splits up the request and selects the right page to be loaded. Fine so far.

Now I have a page displayed when the user requests a page that doesn't exist, you know, 404.

So theoretically, if the user entered mydomain.com/404 (I use mod_rewrite with a requests collector via index.php?req=*) the 404 error would be shown to him, but in fact there was no error - the 404 page would be displayed as a perfectly normal page.

So if someone would try out requesting the 404 page via /404, he would be shown the page but he can't tell if the 404 page he requested doesn't exist and he is actually getting a, you guessed it, 404 error or if he actually found some flaw in the system that makes him able to see an error page when there is no error.

I don't know how dumb this whole thing here is but I'm sure some of you have in fact ran into this problem already.

Short version: If the user enters mydomain.com/404 the 404 page is shown even though there is no 404 error. I know this is a completely irrelevant question, please don't tell me, but I just spontaneously wanted to hear your th开发者_JS百科oughts on it. Strange eh?

  • Should I redirect direct access to my 404-page to the home page?
  • Should I do nothing?
  • Should I just go to bed and stop asking irrelevant stuff?


I think you shouldn't do anything. When the user receives a 404 error, the HTTP response code should be 404. When they request the 404 page, the HTTP response code should be 200 (OK), even though the page content is the same.

Being able to link to people's 404 pages is useful sometimes, especially if they are witty.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜