某些get参数值的错误404

时间:2015-05-18 19:26:18

标签: apache url

我正在一个网站上工作,其中一个脚本称为:

http://localhost/query.php?lat=1.361109&lng=103.828969&rad=2 [404]

我为此URL收到404 Not found错误,同时对于其中一个参数的值略有不同,脚本可以访问并正在执行。 e.g。

http://localhost/query.php?lat=1.361119&lng=103.828969&rad=2  [Working fine]

我在Windows上使用Apache 2.4。任何人都可以指出这可能是什么原因?我没有在项目的任何地方使用.htaccess

1 个答案:

答案 0 :(得分:0)

在某些情况下,服务器端代码可能会检查数据并返回404:

HttpResponseMessage<Book> GetBook(int id)
{
HttpResponseMessage<Book> result;
var book  = _repo.GetBook(id);
if (book != null)
{
    result = new HttpResponseMessage<Book>(book);
}
else
{
  // 404 error 
    result = new HttpResponseMessage<Book>(HttpStatusCode.NotFound);
}
return result;

}