htaccess中的AddType会导致页面下载

use*_*135 9 html php .htaccess

我已经阅读了大约10个这样的问题,但似乎没有回答这个简单的问题.

什么可能导致.htm文件下载而不是作为PHP执行?

我使用以下代码:

AddType application/x-httpd-php htm
Run Code Online (Sandbox Code Playgroud)

我尝试了很多组合但没有成功.

我还能尝试什么?

我只需要.htm和.html文件来执行php.

nic*_*ick 5

使用AddHandler也改变htm.htm并添加.html

AddHandler application/x-httpd-php .htm .html
AddType application/x-httpd-php .htm .html
Run Code Online (Sandbox Code Playgroud)

http://www.suffix.be/blog/addhandler-addtype-directives

  • 还有一件事......确保.htaccess允许覆盖启用`AllowOverride All`http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride (5认同)