apache服务器上的500错误

apache服务器上的500错误

本文介绍了apache服务器上的500错误-“此处不允许AllowOverride”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Mac(OSX 10.9)上设置了服务器,但它在错误日志中返回500错误并显示以下消息……

I have set up a server on my Mac (OSX 10.9) but it's returning a 500 error with the following message in the error log…

[alert] [client ::1] /Users/user/Sites/mysite/.htaccess: AllowOverride not allowed here

这是我的.htaccess文件中的代码

Here's the code in my .htaccess file

Options +FollowSymLinks -MultiViews
AllowOverride All

# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteMap lc int:toLower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^i/(.*)/(.*)-(.*)$ /items/?id=$1&range=$2&type=$3 [L,QSA,NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^c/(.*)$ /category/?menu=$1 [L,QSA,NC]

这是相关的httpd.conf代码(让我知道是否还有其他有用的方法)

And here's the relevant httpd.conf code (let me know if there's anything else that would help)

DocumentRoot "/Users/user/Sites/mysite"

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
</Directory>

<Directory "/Users/user/Sites/mysite">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

有什么想法吗?

推荐答案

AllowOverride全部不属于htaccess文件。在服务器配置(httpd.conf)中使用它来设置htaccess文件可以覆盖的服务器配置参数。因此,显然,能够配置htaccess文件中哪些参数可以从htaccess文件中覆盖是错误的。

AllowOverride All doesn't belong in the htaccess file. It's used in the server config (httpd.conf) to set what an server config parameters an htaccess file can override. So obviously, it would be wrong to be able to configure what parameters htaccess files can override from within htaccess files.

从htaccess文件中删除它。您已经在正确的位置httpd.conf中定义了 AllowOverride All

Remove it from your htaccess file. You've already defined AllowOverride All in your httpd.conf in the right places.

这篇关于apache服务器上的500错误-“此处不允许AllowOverride”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 10:49