httpd-users mailing list archives

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

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 
files

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

public_html/.htaccess:

#-----
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:

public_html/test/.htaccess

#-----
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 http://domain.com/test/index.html which should get 
re-written to http://www.domain.com/test/index.html 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:

http://forums.site5.com/showthread.php?t=10328

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 
sub-directory?

Sincerely,

Johnny 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message