在 Apache 服务器上显示具有其他文件扩展名的 html 文件

在 Apache 服务器上显示具有其他文件扩展名的 html 文件

我们的一个系统生成的文件扩展名为 .asp,但实际上只有 html。我需要在 Apache httpd 服务器上显示这些文件,但该服务器不喜欢 asp 文件。有没有办法指示服务器将这些文件显示为 HTML 文件?

答案1

将其添加到您的 httpd.conf 或 .htaccess 文件。

添加类型文本/html .asp .aspx

sudo a2enmod mime
参考: https://httpd.apache.org/docs/2.4/mod/mod_mime.html#addtype


要列出 apache 加载的模块,请使用:

apachectl -M

相关内容