dpfln86244 2010-03-28 22:40
浏览 20
已采纳

路由重定向决策

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 thoughts 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?
  • 写回答

1条回答 默认 最新

  • dongweng9474 2010-03-28 22:43
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 高维数据处理方法求指导
  • ¥100 数字取证课程 关于FAT文件系统的操作
  • ¥15 如何使用js实现打印时每页设置统一的标题
  • ¥15 安装TIA PortalV15.1报错
  • ¥15 能把水桶搬到饮水机的机械设计
  • ¥15 Android Studio中如何把H5逻辑放在Assets 文件夹中以实现将h5代码打包为apk
  • ¥15 使用小程序wx.createWebAudioContext()开发节拍器
  • ¥15 关于#爬虫#的问题:请问HMDB代谢物爬虫的那个工具可以提供一下吗
  • ¥15 vue3+electron打包获取本地视频属性,文件夹里面有ffprobe.exe 文件还会报错这是什么原因呢?
  • ¥20 用51单片机控制急停。