我需要将我所有的 .html 文件作为 .php 文件运行,而且我没有时间在明天的演示之前更改所有链接。有什么方法可以用我的 Apache 服务器“破解”它吗?
最佳答案
在您网站的根目录下创建一个 .htaccess 文件并添加以下行:
[Apache2 @Ubuntu/Debian:使用这个指令]
AddType application/x-httpd-php .html .htm
或者,来自下面的评论:
AddType application/x-httpd-php5 .html .htm
如果您将 PHP 作为 CGI 运行(可能不是这种情况),您应该改为:
AddHandler application/x-httpd-php .html .htm
关于php - 使用 .htaccess 使所有 .html 页面作为 .php 文件运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4687208/