Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

htaccess basic auth allow only one directory

I am using Drupal 6.

I am trying to use htaccess basic auth to block access to my development site. I have sucessfully added the auth so that only our developers can access it.

But now i want allow anyone to access one module (its links starts with anon/).

For ex: lets assume my site is testsite.com

i want to block all requests to all the pages expect testsite.com/anon/*

is it possible? if yes how?

Thanks in advance.

like image 272
Anush Prem Avatar asked Jun 04 '26 06:06

Anush Prem


1 Answers

EDIT: first reply didn't work. Here's how to do it:

Check the documentation at http://httpd.apache.org/docs/current/mod/core.html#require, which says this:

<Directory /path/to/protected/>
  Require user david
</Directory>
<Directory /path/to/protected/unprotected>
  # All access controls and authentication are disabled
  # in this directory
  Satisfy Any
  Allow from all
</Directory>

This is for Apache 2, btw.

like image 99
Thilo Avatar answered Jun 06 '26 18:06

Thilo