服务器未将 .html 解析为 PHP [英] Server not parsing .html as PHP

查看:20
本文介绍了服务器未将 .html 解析为 PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 .htaccess 文件中有包含的代码,但我尝试包含的 php 代码不起作用.

I have the included code in my .htaccess file but the php code I am attempting to include is not working.

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

推荐答案

尝试:

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

更新 1

它可能是特定于 PHP 版本的.如果您使用的是 PHP5,请尝试:

It may be PHP version specific. If you're using PHP5 try:

AddType application/x-httpd-php5 .html .htm

更新 2

试试:

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

或者这里有另一种替代方法:

Or here's yet another alternative way to do this:

<FilesMatch "\.html$">
    ForceType application/x-httpd-php
</FilesMatch>

这篇关于服务器未将 .html 解析为 PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆