php - How do you pass in a redirect URL into a mod_rewritten page -


How do I modify my pages in a very simple way? I have www.example.com/users/login/ which will internally use users.login.php which acts as a controller. I want to enter a page as a parameter so that login completes.

If you pass in a relative URL, then you end up with a very specific URL because you have something like question / which users / login / Question / like login.php? Redir = questions.php

Does anyone have any comments or solutions on how this URL can be worked well without poorly polluting it? I think the way in which it was handled, was to enter the login form on the "Ask a Question" page. I think this is a solution but I am looking for other possibilities.

Edit: It seems that $ _ server ['HTTP_REFERER'] is not the best solution yet to use it ? I know that you can make fake referees but will there really be any damage?

I use the hidden area in the login form URL and it works for me

  1. Create hidden input fields.
  2. Enter the value of the input field $ referer = isset ($ _ SERVER ['HTTP_REFERER']])? $ _SERVER ['HTTP_REFERER']: '';
  3. Obtain the post url and redirect the user to that URL.

Note: HTTP_REFERER is not always set.


Comments