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开发者_C百科 want to block all requests to all the pages expect testsite.com/anon/*
is it possible? if yes how?
Thanks in advance.
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.
RewriteCond %{REQUEST_URI} !^/anon
RewriteRule ^(.*) error.html [L]
I can't be sure what I understand is the same as what you want to express. I'm a Chinese and my English is not good~_~
Since I stumbled over this and it cost me some time:
The accepted answer is wrong, it is not possible.
(@Thilo, the answerer says so in the comments).
<Directory>
directives don't work in .htaccess
context, only in server config or virtual host context (docs). @Thilo's config will work if you put it that context (i.e. httpd.conf
, vhosts.conf
, or wherever you distro has it) — in .htaccess
, you'll get a 500 Internal Server Error, just like OP.
精彩评论