httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnny" <>
Subject [users@httpd] Mod_Rewrite / Basic Auth BUG or expected behavior?
Date Fri, 19 May 2006 00:39:20 GMT

I have a website hosted on a shared server running apache 1.3.34.

I have access to mod_rewrite and basic authentication via the .htaccess 

I have found that if I have a global .htaccess file in my public_html 
directory containing some simple mod_rewrite such as:


Options -indexes +FollowSymLinks
AddHandler application/x-httpd-php5 .php

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

and then I create a sub-directory, for example test, and protect the 
directory  with basic authentication like:


AuthType Basic
AuthName "test"
AuthUserFile "/home/<username>/.htpasswds/test/passwd"
require valid-user

I then put a test file, for example index.html in this protected directory. 
(ex: public_html/test/index.html)

Then going to a URL like which should get 
re-written to and prompt for 
authentication fails immediately with a 401 code.

However, if this sub directory is not protected, then this mod-rewrite code 
works fine.

For a more detailed description, you may read what I have posted at:

Is this expected behavior or a bug?  If it is expected behavior, then is 
there any way to make mod_rewrite work properly with a protected 



The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message