代码之家  ›  专栏  ›  技术社区  ›  Favio

在尝试显示没有html扩展名的url时,apache的行为很奇怪

  •  3
  • Favio  · 技术社区  · 17 年前

        http://example.com/2005/01/example.html
    
        or
    
        http://example.com/2005/01/example
    

    (实际上,我不知道为什么它在没有扩展的情况下工作。相反,它应该返回通常的404错误。)

        http://example.com/2005/01/example/
        (note the trailing slash)
    

    我收到一个404 Not found错误,但请求的网址打印为:

        http://example.com/2005/01/example.html/
    

    因此,“.html”部分似乎是由apache自动添加的。

        http://example.com/2005/01/example/
    

    谢谢!

    2 回复  |  直到 17 年前
        1
  •  6
  •   Gumbo    17 年前

    MultiViews 可能会导致这种行为。尝试禁用它:

    Options -MultiViews
    
        2
  •  0
  •   Marius    17 年前