Password protecting a folder causes "Page Not Found" error.
denney - April 25, 2007 - 15:44
| Project: | Path |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | by design |
Jump to:
Description
I have a folder under the root of my Drupal installation that I want to password protect.
Accessing this folder without a .htaccess file works fine. If I add a .htaccess file with the usual password protect content, Drupal starts spitting back a "Page Not Found" error instead of prompting me for a password for the folder.

#1
I've tried password-protecting a folder inside my Drupal root using .htaccess and the instructions from the Apache manual and it worked fine.
If you feel this might be a configuration problem in your end, please set the issue category to 'support'. Thanks.
And this is not critical actually :-)
#2
Hmm... must be my use of Path-auto then. I don't know if this is a configuration error because password protection OUTSIDE the Drupal folder works fine.
I've changed this to the path-auto project because this may be the problem.
BTW... setting priority to critical was a mistake. I must have clicked it when I was writing the bug. sorry.
#3
What makes you think that this is caused by pathauto and not just path module? Pathauto merely creates url_aliases automatically. Try disabling the pathauto module and see if you still have the problem. That should show whether it is from pathauto or not.
#4
I'm inclined to mark this as "won't fix" because I don't understand how this could be pahtauto's to fix. I'll leave it as needs more info for a while...
#5
Yeah, you're right. This is caused by the Path module I believe as I have disabled ALL my 3rd party modules and the issue still exists.
#6
OK, I've narrowed it down to the following lines in the .htaccess file of Drupal...
RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Removing the first and second lines make no difference. Removing the last line though and the subdirectory works.
#7
Just had this myself.. adding the follwing too my .htaccess ( the one in the subfolder ) worked a treat.
ErrorDocument 401 "Unauthorized"as per: http://drupal.org/node/30334#comment-125799
r0g.
#8
So, I think we can say this is by design and just requires configuration and/or better documentation.
Denny and/or r0g - could either of you write up a handbook page based on that comment and then link to it from this issue? That would really help reduce the problem for other people in the future.
#9
I've created a simple page at http://drupal.org/node/145227 explaining the problem with the solution provided by r0g. Feel free to modify and update it as it's my first handbook page.
#10
I don't know much about that area of apache configuration - but I do want to say a big thanks for documenting that! It looks great to me.