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

时间:2021-06-11 16:52:41

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?

有任何想法吗?

3 个解决方案

#1


9  

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.

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

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

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

#2


2  

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”,这就是全部。

#3


0  

Take AllowOverride All out of your .htaccess.

从你的.htaccess中取出AllowOverride All。

#1


9  

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.

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

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

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

#2


2  

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”,这就是全部。

#3


0  

Take AllowOverride All out of your .htaccess.

从你的.htaccess中取出AllowOverride All。