kojow7
kojow7

Reputation: 11384

AuthType not allowed here

My .htaccess file was working last year, and as far as I know I had not changed it. However, I am now getting the following error:

AuthType not allowed here

My .htaccess file looks like this:

AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /pwd/.htpasswd
Require valid-user

In case it helps my main apache .conf file for this domain looks like this:

<VirtualHost *:80>
  ServerAdmin [email protected]
  ServerName subdomain.example.com

  DirectoryIndex index.html index.php
  DocumentRoot /var/sites/example.com/subdomain

  LogLevel warn
  ErrorLog /var/sites/example.com/log/error.log
  CustomLog /var/sites/example.com/log/access.log combined
</VirtualHost>

Any ideas what the problem could be?

Upvotes: 6

Views: 8727

Answers (1)

openai_sucks
openai_sucks

Reputation: 1273

AuthType (and other directives) not being allowed "here" is almost certainly a missing AllowOverride allowing .htaccess files to override the directive(s).

https://httpd.apache.org/docs/current/mod/core.html#allowoverride

AllowOverride only goes in <Directory> sections. The solution might look something like this:

<Directory "/var/sites/example.com/subdomain">
    AllowOverride All
</Directory>

which would allow .htaccess overrides only in the /var/sites/example.com/subdomain directory.

A <Directory> directive will already exist and you may wish to modify it rather than add a new one. This search help locate it on most Linux systems:

grep -r "Directory" /etc/httpd/ 

Upvotes: 5

Related Questions