.htaccess文件导致内部服务器错误

时间:2014-10-18 20:20:22

标签: php apache .htaccess mod-rewrite localhost

我的网址网址为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 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', perhaps misspelled or defined by a module not included in the server configuration

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

1 个答案:

答案 0 :(得分:0)

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