简体   繁体   English

apache服务器上的500错误-“此处不允许AllowOverride”

[英]500 Error on apache server - “AllowOverride not allowed here”

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

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

Here's the code in my .htaccess file 这是我的.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]

And here's the relevant httpd.conf code (let me know if there's anything else that would help) 这是相关的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>

Any ideas? 有任何想法吗?

AllowOverride All doesn't belong in the htaccess file. AllowOverride All不属于htaccess文件。 It's used in the server config (httpd.conf) to set what an server config parameters an htaccess file can override . 在服务器配置(httpd.conf)中使用它来设置htaccess文件可以覆盖的服务器配置参数。 So obviously, it would be wrong to be able to configure what parameters htaccess files can override from within htaccess files. 因此很显然,能够配置htaccess文件中哪些参数可以覆盖htaccess文件是错误的。

Remove it from your htaccess file. 从您的htaccess文件中删除它。 You've already defined AllowOverride All in your httpd.conf in the right places. 您已经在正确的位置httpd.conf中定义了AllowOverride All

AllowOverride controls .htaccess-security and -behaviour and could not be set inside of .htaccess files. AllowOverride控制.htaccess-security和-behaviour,因此无法在.htaccess文件中设置。

Drop "AllowOverride All" from .htaccess, thats all. 从.htaccess中删除“ AllowOverride All”,仅此而已。

从您的.htaccess中删除AllowOverride All。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM