【问题标题】:simple mod_rewrite, getting internal server error简单的 mod_rewrite,得到内部服务器错误
【发布时间】:2012-06-08 07:42:14
【问题描述】:

我正在尝试设置一个非常简单的 mod_rewrite .htaccess:

RewriteEngine on
RewriteRule ^contact$ contact.php
RewriteRule ^contact/$ contact.php

但是当我上传 .htaccess 文件时,我得到一个内部服务器错误。发生了什么?

我刚刚检查了httpd.conf文件,mod_rewrite模块在这里,没有任何#。此外 mod_rewrite 正在与服务器中的另一个域一起使用(我没有使用过这个域)。

有没有办法按域激活 mod_rewrite 域?我怎样才能激活它?非常感谢。

编辑:

我刚刚检查了 apache 错误日志,我得到了这个:

[Fri Jun 08 09:36:05 2012] [alert] [client 87.216.xxx.xxx] /var/www/vhost/domain.com/home/html/.htaccess: RewriteEngine not allowed here

有什么线索吗?谢谢。

【问题讨论】:

  • 查看错误日志以了解具体问题是什么
  • 刚刚检查了错误日志,我将错误添加到问题中。

标签: apache mod-rewrite


【解决方案1】:

通常这意味着在服务器/虚拟主机级别、主配置文件或更高的 .htaccess 文件中会有“AllowOverride”阻塞。

使用 AllowOverride/Options 更改检查更高目录中的 .htaccess 文件 - 然后检查主要的 httpd.conf 文件(http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride - 选项) .

Dw

【讨论】:

    【解决方案2】:

    好像没有启用 mod_rewrite。

    【讨论】:

      猜你喜欢
      • 2018-05-10
      • 2011-07-09
      • 1970-01-01
      • 1970-01-01
      • 2014-08-21
      • 2012-04-18
      • 2014-08-05
      • 2017-04-15
      • 2017-09-03
      相关资源
      最近更新 更多