htaccess 500 内部服务器错误
500 Internal Server Error by htaccess
我在 htm
中有包含 php 代码的文件,我可以通过 htaccess 代码运行这些文件。我什么也没做,但现在突然当我试图打开那个页面时,我得到 500 Internal Server Error
我只是从 htaccess 文件中删除所有代码,现在它以文本形式显示我的所有代码。
这是 htaccess 代码
AddHandler application/x-httpd-php5 .htm .php .html
IndexIgnore *
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
为什么我在打开我的网页时得到 500 Internal Server Error
但如果我只是删除显示为文本的代码文件代码。
请指出正确的方向这段代码有什么问题
很可能您正在使用 PHP 作为 Apache 模块。在那种情况下,根 .htaccess 中只有这一行:
AddType application/x-httpd-php .htm .html
当您 运行 PHP 作为 CGI 时,需要 AddHandler
。
我在 htm
中有包含 php 代码的文件,我可以通过 htaccess 代码运行这些文件。我什么也没做,但现在突然当我试图打开那个页面时,我得到 500 Internal Server Error
我只是从 htaccess 文件中删除所有代码,现在它以文本形式显示我的所有代码。
这是 htaccess 代码
AddHandler application/x-httpd-php5 .htm .php .html
IndexIgnore *
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
为什么我在打开我的网页时得到 500 Internal Server Error
但如果我只是删除显示为文本的代码文件代码。
请指出正确的方向这段代码有什么问题
很可能您正在使用 PHP 作为 Apache 模块。在那种情况下,根 .htaccess 中只有这一行:
AddType application/x-httpd-php .htm .html
当您 运行 PHP 作为 CGI 时,需要 AddHandler
。