Reputation: 51
I am trying to put authentication for accessing my document root directory in apache2... Here's my config file
<VirtualHost *:80>
ServerAdmin webmaster@localhost
AccessFileName .htaccess
DocumentRoot /home/user/workspace
<Directory />
Options FollowSymLinks
AllowOverride None.htaccess
</Directory>
<Directory /home/vishu/workspace>
Options Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
allow from all
</Directory>
......
......
</VirtualHost>
here's my .htaccess file in /home/user/workspace folder:
<FilesMatch >
.....
</FilesMatch>
AuthType Basic
AuthName "MY ZONE"
#AuthBasicProvider file
AuthUserFile /home/vishu/workspace/passwordfile
AuthGroupFile /dev/null
Require valid-user
.....
...
Apache gives .htaccess:order not allowed here
error and I am getting 500 error from browser.
Upvotes: 4
Views: 19338
Reputation: 696
Have a look at your AllowOverride
directives. I had this problem too but the following config work for me:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride AuthConfig Limit
Require all granted
</Directory>
AllowOverride All
will probably also work, just depends on how much you want to allow.
Check out these two links for more info:
http://httpd.apache.org/docs/2.2/howto/auth.html
Upvotes: 7
Reputation: 31
I had this same problem and it was due to the restrictions on my host that didn't allow me to add anything with 'Order allow,deny' or other things. So basically I had to comment out all the stuff that wasn't 'allowed' in order to get it to work.
Might want to switch hosts if this is a problem for you.
Upvotes: 2
Reputation: 143916
I'm not sure why you're getting "''order not allowed here''" seeing as you don't have an Order
directive in your htaccess file, but I'm guessing it's probably something in your /
directory because you have override set to None
.
You can try adding overrides in the <Directory />
container, something like:
AllowOverride Limit
as per the Apache documentation
Upvotes: 1