Forum Moderators: phranque

Message Too Old, No Replies

Redirect and password not working together

         

JoaoJose

12:53 am on Jul 29, 2006 (gmt 0)

10+ Year Member



Hi there Apache gurus :)

I think I have a nice problem for you to take a look and hopefuly help me out.

I'm redirecting a domain no a new one except for some directories.

Redirection code:

RewriteEngine on
RewriteCond %{REQUEST_URI}!^/dir1 [NC]
RewriteCond %{REQUEST_URI}!^/dir2 [NC]

RewriteRule ^(.*)$ [newdomain.com...] [R=301,L]

All working ok. But when I try to add a password protection to say dir1 I get redirected (I checked it, it's a 301) to www.newdomain.com/401.shtml

My code for the password protection:

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /home/account/pass
Require user user

Any ideas about this?

Thks!

jdMorgan

4:13 pm on Jul 29, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



*Where* is the password-protection code? If it's in the same .htaccess file as the redirects, then it will be appplied *before* the redirects, regardless of the order of your code.

The simple fix may be to move your password code into the /dir1 and /dir2 subdirectories.

Jim