【问题标题】:.htaccess file causes internal server error.htaccess 文件导致内部服务器错误
【发布时间】:2014-12-14 04:00:19
【问题描述】:

我的网址是http://localhost/Apps/index.php;没有.htaccess 文件也可以正常工作,但是当我添加.htaccess 时,我收到以下错误:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

我的.htaccess文件代码是

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?url=$1 [L, QSA]

PHP 错误日志:

[18-Oct-2014 10:32:34 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.5.12/ext/php_ldap.dll' - The specified module could not be found. in Unknown on line 0

Apache 错误日志:

[Sat Oct 18 06:51:11.609106 2014] [core:alert] [pid 3068:tid 960] [client ::1:3539] C:/wamp/www/Apps/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

我正在使用 WAMP 服务器。我的文件目录是:C:\wamp\www\Apps\index.php Apps 文件夹还包含一个 .htaccess 文件。

【问题讨论】:

  • 检查您的服务器错误日志以了解发生了什么。
  • 我不确定我的代码。这是我的第一个代码。当我删除我的 .htaccess 文件时,我的网站运行良好。

标签: php apache .htaccess mod-rewrite localhost


【解决方案1】:

mod_reqrite 是否已激活? 如果不在您的 httpd.conf 中这样做,请添加或修改: LoadModule rewrite_module modules/mod_rewrite.so 否则,请检查您的日志并将其添加到您的帖子中。

【讨论】:

  • 这里是错误日志:php_error.log:[18-Oct-2014 10:32:34 UTC] PHP 警告:PHP 启动:无法加载动态库 'c:/wamp/bin/php /php5.5.12/ext/php_ldap.dll' - 找不到指定的模块。在第 0 行的未知中 apache_error.log 是:[Sat Oct 18 06:51:11.609106 2014] [core:alert] [pid 3068:tid 960] [client ::1:3539] C:/wamp/www/Apps/ .htaccess: Invalid command 'RewriteEngine',可能是拼写错误或由未包含在服务器配置时间中的模块定义,它们是当前错误。谢谢。
  • [2014 年 10 月 18 日星期六 06:51:11.609106] [core:alert] [pid 3068:tid 960] [client ::1:3539] C:/wamp/www/Apps/.htaccess : 无效的命令“RewriteEngine”,可能拼写错误或由未包含在服务器配置中的模块定义
猜你喜欢
  • 2010-10-07
  • 1970-01-01
  • 2015-11-23
  • 1970-01-01
  • 2013-07-14
  • 2017-07-05
  • 2019-04-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多