Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am doing a rewrite, in an .htaccess file, to another domain like so:

RewriteEngine On
RewriteRule folder/(.*)$1 is password protected.

I get an authentication popup from newdomain when the rewrite happens. When I enter credentials, it authenticates them against the server doing the rewrite, not newdomain. The browser just hangs, and in my server error logs it continuously writes "user x not found" until I stop the connection.

share|improve this question

migrated from Apr 3 '11 at 22:04

This question came from our site for professional and enthusiast programmers.

Which domain is supposed to be doing the authentication? It seems that it should be the new domain, not the old one, given that otherwise one could simply go to the URL with the new domain and access the content without authentication.

In that case, you probably want to rewrite the URL in the user's URL bar, which can be done with the R flag:

RewriteRule folder/(.*)$1 [R]

At that point, everything should be happening on the new domain.

share|improve this answer
There is authentication on both servers which I think may have been the problem. I forgot to add the [P,L] flags, which I was using with the RewriteRule as well. It is working now the way I originally had it. I just changed the htaccess file to point to a different .htpasswd and used Require valid-user instead of Require 'specificUsername'. May have something to do with the new .htpasswd corresponding to one on newdomain... – MF86 Apr 1 '11 at 22:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.