浏览器下载PHP文件而不是打开它们


Browser Downloading PHP files instead of opening them

我编辑了我的htaccess文件,将所有html文件解析为php。文件如下:

AddType application/x-httpd-php .html .htm
AddHandler application/x-httpd-php .html .htm 

页面正在被下载,而不是在浏览器中打开/重定向,我从来没有遇到过我的其他主机服务器的这个问题,所以我现在很困惑。

您可以尝试使用x-httpd-php5并添加SetHander:

AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html
AddHandler x-httpd-php5 .htm
AddHandler x-httpd-php5 .html
<FilesMatch "'.(htm|html|php)$">
SetHandler application/x-httpd-php
</FilesMatch>