服务器没有将.html解析为PHP

服务器没有将.html解析为PHP

我在.htaccess文件中包含了代码,但我试图包含的php代码无效。


Options +Includes

AddType text/html  .htm .html

AddHandler server-parsed .htm .html

AddType application/octet-stream .vcf

AddOutputFilterByType DEFLATE text/html text/htm text/plain text/css text/php    text/javascript application/x-javascript


一只甜甜圈
浏览 353回答 3
3回答

达令说

尝试:AddType&nbsp;application/x-httpd-php&nbsp;.html&nbsp;.htm更新1它可能是PHP版本特定的。如果您使用的是PHP5,请尝试:AddType&nbsp;application/x-httpd-php5&nbsp;.html&nbsp;.htm更新2尝试:RemoveHandler&nbsp;.html&nbsp;.htmAddType&nbsp;application/x-httpd-php&nbsp;.php&nbsp;.htm&nbsp;.html或者这是另一种替代方法:<FilesMatch&nbsp;"\.html$"> &nbsp;&nbsp;&nbsp;&nbsp;ForceType&nbsp;application/x-httpd-php</FilesMatch>

青春有我

在Apache 2.2.22(Ubuntu)上使用Php 5添加这些行&nbsp;/etc/apache2/mods-enabled/php5.conf<FilesMatch&nbsp;".+\.html$"> &nbsp;&nbsp;&nbsp;&nbsp;SetHandler&nbsp;application/x-httpd-php</FilesMatch>并重新启动apachesudo&nbsp;service&nbsp;apache2&nbsp;restart
打开App,查看更多内容
随时随地看视频慕课网APP