【问题标题】:How do I tell Apache to serve files with no extension as text/html?如何告诉 Apache 将没有扩展名的文件作为 text/html 提供?
【发布时间】:2011-11-12 10:38:33
【问题描述】:

考虑一个位于http://www.example.com/mypage.html的网页

不幸的是,有人错误地宣传该页面的地址是 http://www.example.com/mypage - 访问该 URL 的人看到的是 404。

如何配置 Apache 以使 mypage 的访问者最终访问 mypage.html?

我尝试了“ln -s mypage.html mypage”,但显示的是原始 HTML(我猜是因为该文件是作为文本/纯文本提供的)

我想我在 .htaccess 页面中需要一些东西,但我不知道是什么...

【问题讨论】:

标签: html apache mime-types content-type


【解决方案1】:

我宁愿重定向用户而不是采用 mime 类型的方式:

Redirect 301 /mypage http://www.example.com/mypage.html

【讨论】:

    猜你喜欢
    • 2018-10-19
    • 2013-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多