Apache服务器上出现500错误 - "此处不允许AllowOverride"

Tom*_*Tom 5 php apache macos .htaccess httpd.conf

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

[alert] [client ::1] /Users/user/Sites/mysite/.htaccess: AllowOverride not allowed here
Run Code Online (Sandbox Code Playgroud)

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

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]
Run Code Online (Sandbox Code Playgroud)

这是相关的httpd.conf代码(让我知道是否还有其他任何有用的东西)

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>
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

Jon*_*Lin 9

AllowOverride All不属于htaccess文件.它在服务器配置(httpd.conf)中用于设置htaccess文件可以覆盖的服务器配置参数.很明显,能够配置htaccess文件可以在htaccess文件中覆盖的参数是错误的.

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