【发布时间】:2019-12-26 03:07:25
【问题描述】:
我想将 .html 文件作为 .php 运行,但似乎无法正常工作。我尝试将以下所有内容添加到我的 .htaccess 文件中,一次一个。以下似乎都不起作用。
AddType application/x-httpd-php .html .htm
AddHandler application/x-httpd-php5 .html .htm
AddType application/x-httpd-php72 .html .htm
AddHandler application/x-httpd-php5 .html .htm
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
<FilesMatch "\.html$">
ForceType application/x-httpd-php
</FilesMatch>
AddHandler fcgid-script .html
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .html
Options +ExecCGI
AddType application/x-httpd-php .php .html
AddHandler x-httpd-php5 .php .html
我知道 PHP 可以工作,因为我能够创建一个文档 .php 并查看 网站上使用的版本:
<?php
echo 'Current PHP version: ' . phpversion();
?>
它返回:“当前 PHP 版本:7.2.21”
一些值得注意的信息:我在 Bluehost 上托管网站,而 .htaccess 文件目前看起来像这样:
# Redirect HTTP to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
【问题讨论】:
-
不幸的是它不起作用@tim。我也试过了,上面忘记说了。
-
然后问房东,你付钱
标签: php html .htaccess web bluehost