2

I'm currently upgrading to Apache 2.4.

What puzzles me right now is how to create a public subdirectory using .htaccess only. The outer directory is protected by AuthType Basic

Previously, the directory contained the following .htaccess:

Satisfy Any Allow from all 

I'm at a loss at how to reproduce this in Apache 2.4. I tried any combination of the following, without luck:

AuthType None Require all granted AuthMerging Or 
2
  • What exactly is the problem you're seeing ? What error messages do you see, what did you expect, are there any relevant log messages ? Commented Feb 16, 2014 at 6:42
  • Expected behavior: No login prompt upon accessing the subdirectory. Actual: Login prompt. Commented Feb 16, 2014 at 14:30

1 Answer 1

2

I tested this here and it works for me. Check that the .htaccess file is being read for each directory; perhaps enable authentication on the subdirectory temporarily with a different AuthName so you can verify.

Here's my setup, in case you find it useful. The directory with auth enabled is authtest; its subdirectory noauth has authentication disabled.

$ /usr/sbin/apache2 -v Server version: Apache/2.4.7 (Debian) Server built: Jan 2 2014 01:47:52 $ cat /etc/apache2/conf-enabled/allow-htaccess-authtest.conf <Directory /var/www/html/authtest> AllowOverride AuthConfig </Directory> $ cat /var/www/html/authtest/.htaccess AuthType Basic AuthName "ahoy hoy" AuthUserFile /home/fission/htpasswd Require valid-user $ cat /var/www/html/authtest/noauth/.htaccess AuthType None Require all granted 

That syntax was pulled directly from the Apache docs for mod_authn_core

1
  • 1
    Thanks, this indeed does work. In the meantime, I checked everything again and found I had the authentication defined twice, in .htaccess and also in a <Location "/"> block in the virtual host config. According to this page, <Location> takes precedence over (almost) everything. Which is why I was unable to override it using .htaccess. Commented Feb 16, 2014 at 16:06

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.