Apache服务器(AMPPS)上的HTML文件下载而不是打开

3
昨天我在编辑我的Apache服务器的http.conf文件,以便它可以在HTML文件中编译PHP。一切都很顺利,所有的文件都能够正常打开,但是今天它却只下载HTML文件而不是打开它们,只有PHP文件目前能够正常工作。
我的配置如下:
  <IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types

#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
RemoveHandler .html .htm 
AddType application/x-httpd-php5 .html .htm
AddType application/x-tar .tgz
AddType image/x-icon .ico
AddType application/vnd.wap.wmlc .wmlc
AddType application/x-httpd-php .phtml .pwml .php5 .php4 .php3 .php2 .php .inc
AddType text/vnd.wap.wml .wml
AddType text/vnd.wap.wmlscript .wmls
AddType text/vnd.wap.wmlscriptc .wmlsc
AddType image/vnd.wap.wbmp .wbmp

#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi .pl

# For type maps (negotiated resources):
#AddHandler type-map var

#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

顺便说一下,“RemoveHandler .html .htm”这行代码是昨天我添加的之一,目的是将php编译到html中,我试着去掉它但还是一样的。


1
像这样的更改后,您必须重新启动(重新加载)Apache。 - YvesLeBorg
我找到了问题,缺少了这个 // AddType application/x-httpd-php .html .htm \ 谢谢你提醒我每次更改后都要重新启动。 - Xtrem fabz
很高兴你已经开始运行了。有机会的话,请将其写成答案并接受它。这会帮助其他人。 - YvesLeBorg
1个回答

0

我找到了问题,这个 // AddType application/x-httpd-php .html .htm // 没有加上


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接