简体   繁体   中英

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...

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM