I have an Apache config that restricts access to to a website, using the following code –
<Directory /var/www/html/website/test/>
AuthName "Dyne Drewett Test Site"
AuthType Basic
AuthUserFile /usr/local/etc/apache/.htpasswd
require valid-user
</Directory>
Does anybody know how I can amend this to allow full, unauthorised access to one directory under /test/
? Thanks.
Update
After some help from @dunxd I now have this, which I'm guessing must be wrong as I'm still getting the 401 error when going to the page that is requested (found with the /dyne_drewett/
directory). Any further help would be great.
# Main directory rules
<Directory /var/www/html/website/test/>
# General access to the site
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from 192.168.1
# Authorisation settings
AuthName "Dyne Drewett Test Site"
AuthType Basic
AuthUserFile /usr/local/etc/apache/.htpasswd
require valid-user
</Directory>
# Theme directory rules
<Directory /var/www/html/website/test/wp-content/themes/dyne_drewett/>
# General access to the folder
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
# Authorisation settings
AuthType None
require all granted
</Directory>
Best Answer
There are a couple of ways of achieving this.
Simplest way is to create another Directory entry for the subdirectory with AuthType set to None like this:
Another approach uses a different URL pointing to the directory. In Apache docs for Directory directive there is a comment saying:
You could use that to your advantage here - create a symlink from /allowed/ to your subdirectory under /test/ and use that URL to point to the directory.