I mod_rewrite my pages very similar to how SO does it. I have www.example.com/users/login/ which will internally use users.login.php which acts as a controller. I want to pass in a parameter as a page to redirect to once the login is complete.
If you pass in a relative URL you end up with a very peculiar looking URL because you are passing in something like questions/ which looks like users/login/questions/ instead of login.php?redir=questions.php
Does anyone have any comments or solutions for how this can be worked out nicely without polluting the URL horribly? I think the way SO handled it was to put the login form ON the "Ask Question" page. I suppose that is a solution but I'm looking for other possibilities.
Edit: It seems like using $_SERVER['HTTP_REFERER'] is the best solution so far. Is there any reason not to use it? I realize you can fake the referer but will that actually cause any damages?