Forum Moderators: phranque

Message Too Old, No Replies

http authed webpage not found after redirect

         

gasell

2:36 pm on Dec 4, 2010 (gmt 0)

10+ Year Member



I've got 2 registered domains, a.com and b.com. One hosting account. Right now a.com is the primary one and so I've set up 301 redirect to b.com because the plan is to get rid of domain a.

The redirect works fine generally, but I have an http authed directory under domain a and this does not work. When a.com/authed_dir is asked I expect it redirected to b.com/authed_dir as is done with any other directory successfully and then http auth dialog. This does not happen, instead I'm shown 404 page. As soon as I turn http auth off it redirects as I expect.

Why is that? How can I have both redirection and http auth working?

Redirect is following:
RewriteCond %{HTTP_HOST} ^a.com [NC]
RewriteRule (.*) http://b.com/$1 [L,R=301]

g1smd

3:48 pm on Dec 4, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It is likely that HTTPS requests resolve to a different folder within the server, and you need to place your https redirect directives in that folder.

gasell

2:58 pm on Dec 5, 2010 (gmt 0)

10+ Year Member



There is no https involved. All plain http.

g1smd

6:28 pm on Dec 5, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Sorry, misread the question. It's certainly a weird scenario and not one I have seen before.

jdMorgan

2:29 am on Dec 7, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



http authentication is done before any redirects or rewrites. That is, mod_auth runs before mod_alias and mod_rewrite.

You might consider either excluding that authenticated directory from your redirect, or using something like a SSI conditional meta-refresh to forward to the correct domain *after* authentication is complete.

It's always a mess "untangling" unshareable things that have been shared, such as authenticated directories, http/https resources, cookies, etc...

Jim