500 Error on apache server - "AllowOverride not allowed here"

Tom picture Tom · Nov 22, 2013 · Viewed 29.1k times · Source

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

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]

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>

Any ideas?

Answer

Jon Lin picture Jon Lin · Nov 22, 2013

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.

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