开发者

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

开发者 https://www.devze.com 2023-04-03 02:50 出处:网络
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 se

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

精彩评论

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