Welcome Guest, Not a member yet? Register   Sign In
.htaccess: rewrite and password protection
#1

[eluser]Unknown[/eluser]
I'm experiencing a strange interaction between two .htaccess files that I can't quite figure out. It seems like the friendly URL rewrite rules are keeping me from using Basic .htaccess authentication in a subdirectory. First, I've got a root .htaccess that rewrites URLs for CodeIgniter:

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1

Also, I have a sub-directory called "protected_dir" in the root directory with some resources that I want behind a password. So, in /protected_dir, I have an .htaccess file for password protection:

Code:
AuthType Basic
AuthName "Protected Stuff"
AuthUserFile "/home/username/.htpasswds/public_html/protected_dir/passwd"
require valid-user

When I try to load http://www.myurl.com/protected_dir/, I'm being sent to my CodeIgniter app through index.php. I would have thought, because I requested a valid directory, that mod-rewrite would be cool about it.

Strangely, if I turn the RewriteEngine Off while I authenticate to the protected directory, then turn it back On, the problem goes away. I can get to the protected files with no problem. It's only on the authentication step itself that things go hawire. Any ideas?
#2

[eluser]Glowball[/eluser]
I'm having the exact issue and can't find the solution. http://ellislab.com/forums/viewthread/50322/ listed the same issue, with no solution. Does anyone know how to do this? I've tried putting RewriteEngine off in the .htaccess file in my protected directory, too, but that doesn't do it. Help?

Edit: Nevermind, I did some more digging and added this to my main directory .htaccess file and now everything works!

Code:
RewriteCond $1 !^(401.shtml)




Theme © iAndrew 2016 - Forum software by © MyBB