Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Using the mod_form_auth module in Apache HTTPD 2.4.3, I am looking for a way to have the user redirected to their original desired target after completing a login.

That is, if I have a

<Location /protected>
   ... form auth config here
</Location>

the user might browse to /protected/a, or to protected/b. In either case, they will be presented with the login form. However, as far as I can see, I must specific a single 'success' URL. I'm wondering if I'm missing some Apache feature that would allow me to, for example, cause the redirect to the login form go to something like:

https://login.html?origTarget=/protected/a

via some syntax on the AuthForLoginRequiredLocation statement?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You need to use the AuthFormLocation directive.

The AuthFormLocation directive specifies the name of an HTML field which, if present, will contain a URL to redirect the browser to should login be successful.

share|improve this answer
    
how would that field end up containing the correct original URL that the user navigated to? –  bmargulies Sep 21 '12 at 19:03
    
I imagine you will need to write this out using your server-side script. As I understand it AuthFormLoginRequiredLocation overrides the ErrorDocument directive. In an error document you can refer to $_SERVER['REQUESTED_URI'] (PHP) to get the originally requested URL - does this work for you? –  w3d Sep 21 '12 at 22:03

Your Answer

 
discard

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.