开发者

How do I tell Apache to serve files with no extension as text/html?

Consider a webpage, located at http://www.example.com/mypage.html

Unfortunately, someone wrongly advertises that the page's address is http://www.example.com/mypage - people visiting that URL are seeing a 404.

How can I configure Apache so visitors to mypage end up at mypage.html ?

I tried "ln -s mypage.html mypage", but the raw HTML was displayed (I guess because the file was served as text/plain)

I guess I need something in a .htaccess page but I can't work out开发者_高级运维 what...


I would rather redirect the user in stead of going the mime-type way:

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜